codea: sub und mul mit feldern
authorBernhard Urban <lewurm@gmail.com>
Mon, 17 May 2010 23:10:29 +0000 (01:10 +0200)
committerBernhard Urban <lewurm@gmail.com>
Mon, 17 May 2010 23:10:29 +0000 (01:10 +0200)
codea/lewurm_12.instr
codea/lewurm_13.instr
codea/lewurm_14.0 [new file with mode: 0644]
codea/lewurm_14.call [new file with mode: 0644]
codea/lewurm_14.instr [new file with mode: 0644]

index f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2..1e8b314962144c26d5e0e50fd29d2ca327864913 100644 (file)
@@ -1 +1 @@
-10
+6
index f599e28b8ab0d8c9c57a486c89c4a5132dcbd3b2..7f8f011eb73d6043d2e6db9d2c101195ae2801f2 100644 (file)
@@ -1 +1 @@
-10
+7
diff --git a/codea/lewurm_14.0 b/codea/lewurm_14.0
new file mode 100644 (file)
index 0000000..83e59da
--- /dev/null
@@ -0,0 +1,21 @@
+struct foo bar end;
+
+method f1(a b)
+       return a.foo * 5;
+end;
+
+method f2(a b)
+       return b.foo - (100 - a.foo);
+end;
+
+method f3(a b)
+       return b.foo - (100 - 50 - a.foo);
+end;
+
+method f4(a b)
+       return a.foo * a.bar;
+end;
+
+method f5(a b)
+       return b.foo - (100 - a.foo - b.foo);
+end;
diff --git a/codea/lewurm_14.call b/codea/lewurm_14.call
new file mode 100644 (file)
index 0000000..7288b0a
--- /dev/null
@@ -0,0 +1,15 @@
+long f1(long, long*, long*);
+long f2(long, long*, long*);
+long f3(long, long*, long*);
+long f4(long, long*, long*);
+long f5(long, long*, long*);
+
+long muh[] = {0x05f05f, 0x223344};
+long kuh[] = {0x00AACC, 0x563425};
+
+RET(f1(0, muh, kuh) == muh[0] * 5 &&
+       f2(0, muh, kuh) == kuh[0] - (100 - muh[0]) &&
+       f3(0, muh, kuh) == kuh[0] - (100 - 50 - muh[0]) &&
+       f5(0, muh, kuh) == kuh[0] - (100 - muh[0] - kuh[0]) &&
+       f4(0, muh, kuh) == muh[0] * muh[1]
+       );
diff --git a/codea/lewurm_14.instr b/codea/lewurm_14.instr
new file mode 100644 (file)
index 0000000..a45fd52
--- /dev/null
@@ -0,0 +1 @@
+24