From 24866fce9b852d617a1cbfd9837120d6d0bd9656 Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Tue, 18 May 2010 01:10:29 +0200 Subject: [PATCH] codea: sub und mul mit feldern --- codea/lewurm_12.instr | 2 +- codea/lewurm_13.instr | 2 +- codea/lewurm_14.0 | 21 +++++++++++++++++++++ codea/lewurm_14.call | 15 +++++++++++++++ codea/lewurm_14.instr | 1 + 5 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 codea/lewurm_14.0 create mode 100644 codea/lewurm_14.call create mode 100644 codea/lewurm_14.instr diff --git a/codea/lewurm_12.instr b/codea/lewurm_12.instr index f599e28..1e8b314 100644 --- a/codea/lewurm_12.instr +++ b/codea/lewurm_12.instr @@ -1 +1 @@ -10 +6 diff --git a/codea/lewurm_13.instr b/codea/lewurm_13.instr index f599e28..7f8f011 100644 --- a/codea/lewurm_13.instr +++ b/codea/lewurm_13.instr @@ -1 +1 @@ -10 +7 diff --git a/codea/lewurm_14.0 b/codea/lewurm_14.0 new file mode 100644 index 0000000..83e59da --- /dev/null +++ b/codea/lewurm_14.0 @@ -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 index 0000000..7288b0a --- /dev/null +++ b/codea/lewurm_14.call @@ -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 index 0000000..a45fd52 --- /dev/null +++ b/codea/lewurm_14.instr @@ -0,0 +1 @@ +24 -- 2.25.1