aboutsummaryrefslogtreecommitdiff
path: root/src/interp/g-util.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-07-22 00:33:05 +0000
committerdos-reis <gdr@axiomatics.org>2010-07-22 00:33:05 +0000
commitc1da0d2561b27741a6feb73336b0712f5ddc7e97 (patch)
tree72afdd59d1591eb5278ca74254bdc6aa58f6e2fe /src/interp/g-util.boot
parent108ea45edebe23267cc7f4d8620f034fd1b39b81 (diff)
downloadopen-axiom-c1da0d2561b27741a6feb73336b0712f5ddc7e97.tar.gz
* algebra/data.spad.pamphlet (Byte) [~]: Tidy.
(SystemNonNegativeInteger) [~]: Likewise. * interp/g-util.boot: Better expansion of byte operations.
Diffstat (limited to 'src/interp/g-util.boot')
-rw-r--r--src/interp/g-util.boot32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index df6628f9..012a9ccc 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -230,6 +230,20 @@ expandPeq ['%peq,x,y] ==
expandBefore? ['%before?,x,y] ==
['GGREATERP,expandToVMForm y,expandToVMForm x]
+-- Byte operations
+expandBle ['%ble,x,y] ==
+ expandToVMForm ['%not,['%blt,y,x]]
+
+expandBgt ['%bgt,x,y] ==
+ expandToVMForm ['%blt,y,x]
+
+expandBge ['%bge,x,y] ==
+ expandToVMForm ['%not,['%blt,x,y]]
+
+expandBcompl ['%bcompl,x] ==
+ integer? x => 255 - x
+ ['_+,256,['LOGNOT,expandToVMForm x]]
+
-- Integer operations
expandIneg ['%ineg,x] ==
x := expandToVMForm x
@@ -237,12 +251,16 @@ expandIneg ['%ineg,x] ==
['_-,x]
expandIlt ['%ilt,x,y] ==
- integer? x and x = 0 => ['PLUSP,expandToVMForm y]
- integer? y and y = 0 => ['MINUSP,expandToVMForm x]
+ integer? x and x = 0 =>
+ integer? y => y > 0
+ ['PLUSP,expandToVMForm y]
+ integer? y and y = 0 =>
+ integer? x => x < 0
+ ['MINUSP,expandToVMForm x]
['_<,expandToVMForm x,expandToVMForm y]
expandIgt ['%igt,x,y] ==
- expandFlt ['%ilt,y,x]
+ expandIlt ['%ilt,y,x]
expandBitand ['%bitand,x,y] ==
['BOOLE,'BOOLE_-AND,expandToVMForm x,expandToVMForm y]
@@ -331,9 +349,6 @@ for x in [
-- byte operations
['%beq, :'byteEqual],
['%blt, :'byteLessThan],
- ['%ble, :'byteLessEqual],
- ['%bgt, :'byteGreaterThan],
- ['%bge, :'byteGreaterEqual],
-- unary integer operations.
['%iabs, :'ABS],
@@ -417,6 +432,11 @@ for x in [
['%loop, :function expandLoop],
['%return, :function expandReturn],
+ ['%ble, :function expandBle],
+ ['%bgt, :function expandBgt],
+ ['%bge, :function expandBge],
+ ['%bcompl, :function expandBcompl],
+
['%igt, :function expandIgt],
['%ilt, :function expandIlt],
['%ineg, :function expandIneg],