aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang')
-rw-r--r--new-luxc/source/luxc/lang/extension/analysis/common.lux6
-rw-r--r--new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux14
-rw-r--r--new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/js.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/js/eval.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux12
-rw-r--r--new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux30
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux12
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux12
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux14
-rw-r--r--new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux12
-rw-r--r--new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux40
-rw-r--r--new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux12
-rw-r--r--new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux12
-rw-r--r--new-luxc/source/luxc/lang/translation/r/eval.jvm.lux4
-rw-r--r--new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux12
-rw-r--r--new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux42
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux12
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux12
-rw-r--r--new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux14
-rw-r--r--new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux8
22 files changed, 130 insertions, 166 deletions
diff --git a/new-luxc/source/luxc/lang/extension/analysis/common.lux b/new-luxc/source/luxc/lang/extension/analysis/common.lux
index 220613dbf..c63d063cd 100644
--- a/new-luxc/source/luxc/lang/extension/analysis/common.lux
+++ b/new-luxc/source/luxc/lang/extension/analysis/common.lux
@@ -204,9 +204,9 @@
(install "and" (binary Nat Nat Nat))
(install "or" (binary Nat Nat Nat))
(install "xor" (binary Nat Nat Nat))
- (install "shift-left" (binary Nat Nat Nat))
- (install "unsigned-shift-right" (binary Nat Nat Nat))
- (install "shift-right" (binary Int Nat Int))
+ (install "left-shift" (binary Nat Nat Nat))
+ (install "logical-right-shift" (binary Nat Nat Nat))
+ (install "arithmetic-right-shift" (binary Int Nat Int))
)))
(def: nat-procs
diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux
index fe9fe43be..27a92c1cc 100644
--- a/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/common-lisp/procedure/common.jvm.lux
@@ -157,18 +157,18 @@
[bit//xor _.logxor]
)
-(def: (bit//shift-left [subjectO paramO])
+(def: (bit//left-shift [subjectO paramO])
Binary
(_.ash (_.rem (_.int 64) paramO) subjectO))
-(def: (bit//signed-shift-right [subjectO paramO])
+(def: (bit//arithmetic-right-shift [subjectO paramO])
Binary
(_.ash (|> paramO (_.rem (_.int 64)) (_.* (_.int -1)))
subjectO))
-(def: (bit//shift-right [subjectO paramO])
+(def: (bit//logical-right-shift [subjectO paramO])
Binary
- (runtimeT.bit//shift-right (_.rem (_.int 64) paramO) subjectO))
+ (runtimeT.bit//logical-right-shift (_.rem (_.int 64) paramO) subjectO))
(def: bit-procs
Bundle
@@ -177,9 +177,9 @@
(install "and" (binary bit//and))
(install "or" (binary bit//or))
(install "xor" (binary bit//xor))
- (install "shift-left" (binary bit//shift-left))
- (install "unsigned-shift-right" (binary bit//shift-right))
- (install "shift-right" (binary bit//signed-shift-right))
+ (install "left-shift" (binary bit//left-shift))
+ (install "logical-right-shift" (binary bit//logical-right-shift))
+ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift))
)))
## [[Arrays]]
diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux
index 33f72b995..96393c970 100644
--- a/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/common-lisp/runtime.jvm.lux
@@ -195,7 +195,7 @@
@@product//right
@@sum//get)))
-(runtime: (bit//shift-right shift input)
+(runtime: (bit//logical-right-shift shift input)
(_.if (_.= (_.int 0) (@@ shift))
(@@ input)
(|> (@@ input)
@@ -204,7 +204,7 @@
(def: runtime//bit
Runtime
- (_.progn (list @@bit//shift-right)))
+ (_.progn (list @@bit//logical-right-shift)))
(do-template [<name> <top-cmp>]
[(def: (<name> top value)
diff --git a/new-luxc/source/luxc/lang/translation/js.lux b/new-luxc/source/luxc/lang/translation/js.lux
index b318c7fbc..3e9b1b143 100644
--- a/new-luxc/source/luxc/lang/translation/js.lux
+++ b/new-luxc/source/luxc/lang/translation/js.lux
@@ -222,9 +222,9 @@
(def: low-mask
Nat
- (|> +1 (bit.shift-left +32) n/dec))
+ (|> +1 (bit.left-shift +32) n/dec))
-(def: #export high (-> Nat Nat) (bit.shift-right +32))
+(def: #export high (-> Nat Nat) (bit.logical-right-shift +32))
(def: #export low (-> Nat Nat) (bit.and low-mask))
(interface: IntValue
diff --git a/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux
index 3d4dbc782..5b2499eb0 100644
--- a/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/js/eval.jvm.lux
@@ -64,9 +64,9 @@
[[(Number::longValue [] (:! Number high))
(Number::longValue [] (:! Number low))]
[high low]])
- (#.Some (nat-to-int (n/+ (|> high (:! Nat) (bit.shift-left +32))
+ (#.Some (nat-to-int (n/+ (|> high (:! Nat) (bit.left-shift +32))
(if (i/< 0 (:! Int low))
- (|> low (:! Nat) (bit.shift-left +32) (bit.shift-right +32))
+ (|> low (:! Nat) (bit.left-shift +32) (bit.logical-right-shift +32))
(|> low (:! Nat))))))
_
diff --git a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux
index 2e1bf8389..270fa510d 100644
--- a/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/js/primitive.jvm.lux
@@ -13,12 +13,12 @@
(-> Bool (Meta Expression))
(|>> %b meta/wrap))
-(def: low-mask Nat (n/dec (bit.shift-left +32 +1)))
+(def: low-mask Nat (n/dec (bit.left-shift +32 +1)))
(def: #export (translate-nat value)
(-> Nat (Meta Expression))
(let [high (|> value
- (bit.shift-right +32)
+ (bit.logical-right-shift +32)
nat-to-int %i)
low (|> value
(bit.and low-mask)
diff --git a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
index 15c48a138..14e37efb8 100644
--- a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
@@ -163,9 +163,9 @@
(let [simple-param (format runtimeT.int//to-number "(" paramJS ")")]
(format <op> "(" subjectJS "," simple-param ")")))]
- [bit//shift-left runtimeT.bit//shift-left]
- [bit//shift-right runtimeT.bit//signed-shift-right]
- [bit//unsigned-shift-right runtimeT.bit//shift-right]
+ [bit//left-shift runtimeT.bit//left-shift]
+ [bit//arithmetic-right-shift runtimeT.bit//arithmetic-right-shift]
+ [bit//logical-right-shift runtimeT.bit//logical-right-shift]
)
(def: (bit//count subjectJS)
@@ -474,9 +474,9 @@
(install "and" (binary bit//and))
(install "or" (binary bit//or))
(install "xor" (binary bit//xor))
- (install "shift-left" (binary bit//shift-left))
- (install "unsigned-shift-right" (binary bit//unsigned-shift-right))
- (install "shift-right" (binary bit//shift-right))
+ (install "left-shift" (binary bit//left-shift))
+ (install "logical-right-shift" (binary bit//logical-right-shift))
+ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift))
)))
(def: nat-procs
diff --git a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux
index 2adb118f8..afb3cd538 100644
--- a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux
@@ -310,7 +310,7 @@
"return " cast ";"
"})")))
-(runtime: bit//shift-left "shlI64"
+(runtime: bit//left-shift "shlI64"
(format "(function " @ "(input,shift) {"
"shift &= 63;"
(format "if(shift === 0) {"
@@ -329,7 +329,7 @@
"}")
"})"))
-(runtime: bit//signed-shift-right "shrI64"
+(runtime: bit//arithmetic-right-shift "shrI64"
(format "(function " @ "(input,shift) {"
"shift &= 63;"
(format "if(shift === 0) {"
@@ -349,7 +349,7 @@
"}")
"})"))
-(runtime: bit//shift-right "ushrI64"
+(runtime: bit//logical-right-shift "ushrI64"
(format "(function " @ "(input,shift) {"
"shift &= 63;"
(format "if(shift === 0) {"
@@ -379,9 +379,9 @@
__bit//not
__bit//count32
__bit//count
- __bit//shift-left
- __bit//signed-shift-right
- __bit//shift-right))
+ __bit//left-shift
+ __bit//arithmetic-right-shift
+ __bit//logical-right-shift))
(runtime: int//- "subI64"
(format "(function " @ "(l,r) {"
@@ -494,8 +494,8 @@
[(=I int//min "parameter")
(js.return! int//one)])
(js.block! (list (js.var! "approximation"
- (#.Some (js.apply bit//shift-left
- (list (recur (js.apply bit//signed-shift-right
+ (#.Some (js.apply bit//left-shift
+ (list (recur (js.apply bit//arithmetic-right-shift
(list "subject" (js.number 1.0)))
"parameter")
(js.number 1.0)))))
@@ -628,7 +628,7 @@
[(>N "subject" "parameter")
(js.return! int//zero)]
- [(>N (js.apply bit//shift-right
+ [(>N (js.apply bit//logical-right-shift
(list "subject" (js.number 1.0)))
"parameter")
(js.return! int//one)])
@@ -684,11 +684,11 @@
"var lH = " int//from-number "(l.H);"
"var rH = " int//from-number "(r.H);"
- "var bottom = " bit//shift-right "(" int//* "(lL,rL),32);"
+ "var bottom = " bit//logical-right-shift "(" int//* "(lL,rL),32);"
"var middle = " int//+ "(" int//* "(lH,rL)," int//* "(lL,rH));"
"var top = " int//* "(lH,rH);"
- "var bottomAndMiddle = " bit//shift-right "(" int//+ "(middle,bottom),32);"
+ "var bottomAndMiddle = " bit//logical-right-shift "(" int//+ "(middle,bottom),32);"
"return " int//+ "(top,bottomAndMiddle);"
"})"))
@@ -698,7 +698,7 @@
"var zeroes = 64;"
(format "while(!" int//= "(input," int//zero ")) {"
"zeroes--;"
- "input = " bit//shift-right "(input,1);"
+ "input = " bit//logical-right-shift "(input,1);"
"}")
"return zeroes;"
"})"))
@@ -710,9 +710,9 @@
"}"
"else {"
"var minShift = Math.min(" deg//leading-zeroes "(l), " deg//leading-zeroes "(r));"
- "l = " bit//shift-left "(l,minShift);"
- "r = " bit//shift-left "(r,minShift);"
- "return " bit//shift-left "(" int/// "(l," int//from-number "(r.H)),32);"
+ "l = " bit//left-shift "(l,minShift);"
+ "r = " bit//left-shift "(r,minShift);"
+ "return " bit//left-shift "(" int/// "(l," int//from-number "(r.H)),32);"
"}")
"})"))
diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux
index 8289fdf5a..3a5cc9b70 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux
@@ -220,9 +220,9 @@
<op>
($i.wrap #$.Long)))]
- [bit//shift-left $i.LSHL]
- [bit//shift-right $i.LSHR]
- [bit//unsigned-shift-right $i.LUSHR]
+ [bit//left-shift $i.LSHL]
+ [bit//arithmetic-right-shift $i.LSHR]
+ [bit//logical-right-shift $i.LUSHR]
)
## [[Arrays]]
@@ -618,9 +618,9 @@
(install "and" (binary bit//and))
(install "or" (binary bit//or))
(install "xor" (binary bit//xor))
- (install "shift-left" (binary bit//shift-left))
- (install "unsigned-shift-right" (binary bit//unsigned-shift-right))
- (install "shift-right" (binary bit//shift-right))
+ (install "left-shift" (binary bit//left-shift))
+ (install "logical-right-shift" (binary bit//logical-right-shift))
+ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift))
)))
(def: nat-procs
diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
index 2bef7cbcf..bdba05a9d 100644
--- a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
@@ -154,9 +154,9 @@
Binary
(<op> paramO subjectO))]
- [bit//shift-left lua.bit-shl]
- [bit//shift-right lua.bit-shr]
- [bit//unsigned-shift-right runtimeT.bit//shift-right]
+ [bit//left-shift lua.bit-shl]
+ [bit//arithmetic-right-shift lua.bit-shr]
+ [bit//logical-right-shift runtimeT.bit//logical-right-shift]
)
(def: bit//count
@@ -461,9 +461,9 @@
(install "and" (binary bit//and))
(install "or" (binary bit//or))
(install "xor" (binary bit//xor))
- (install "shift-left" (binary bit//shift-left))
- (install "unsigned-shift-right" (binary bit//unsigned-shift-right))
- (install "shift-right" (binary bit//shift-right))
+ (install "left-shift" (binary bit//left-shift))
+ (install "logical-right-shift" (binary bit//logical-right-shift))
+ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift))
)))
(def: nat-procs
diff --git a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
index e0b037bf5..64253b1c3 100644
--- a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
@@ -176,7 +176,7 @@
@@product//right
@@sum//get))
-(runtime: (bit//shift-right param subject)
+(runtime: (bit//logical-right-shift param subject)
(let [mask (|> (lua.int 1)
(lua.bit-shl (lua.- param (lua.int 64)))
(lua.- (lua.int 1)))]
@@ -195,7 +195,7 @@
(def: runtime//bit
Runtime
(format @@bit//count
- @@bit//shift-right))
+ @@bit//logical-right-shift))
(runtime: (nat//< param subject)
(lua.return! (lua.apply "math.ult" (list subject param))))
@@ -234,24 +234,24 @@
(runtime: (deg//* param subject)
(lua.block! (list (lua.local! "sL" (#.Some (lua.bit-and deg//low-mask subject)))
- (lua.local! "sH" (#.Some (bit//shift-right (lua.int 32) subject)))
+ (lua.local! "sH" (#.Some (bit//logical-right-shift (lua.int 32) subject)))
(lua.local! "pL" (#.Some (lua.bit-and deg//low-mask param)))
- (lua.local! "pH" (#.Some (bit//shift-right (lua.int 32) param)))
- (lua.local! "bottom" (#.Some (bit//shift-right (lua.int 32)
+ (lua.local! "pH" (#.Some (bit//logical-right-shift (lua.int 32) param)))
+ (lua.local! "bottom" (#.Some (bit//logical-right-shift (lua.int 32)
(lua.* "pL" "sL"))))
(lua.local! "middle" (#.Some (lua.+ (lua.* "pL" "sH")
(lua.* "pH" "sL"))))
(lua.local! "top" (#.Some (lua.* "pH" "sH")))
(lua.return! (|> "bottom"
(lua.+ "middle")
- (bit//shift-right (lua.int 32))
+ (bit//logical-right-shift (lua.int 32))
(lua.+ "top"))))))
(runtime: (deg//leading-zeroes input)
(lua.block! (list (lua.local! "zeroes" (#.Some (lua.int 64)))
(lua.while! (lua.not (lua.= (lua.int 0) input))
(lua.block! (list (lua.set! "zeroes" (lua.- (lua.int 1) "zeroes"))
- (lua.set! input (bit//shift-right (lua.int 1) input)))))
+ (lua.set! input (bit//logical-right-shift (lua.int 1) input)))))
(lua.return! "zeroes"))))
(runtime: (deg/// param subject)
diff --git a/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux
index 33c7d645e..5850c0098 100644
--- a/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/php/procedure/common.jvm.lux
@@ -161,7 +161,7 @@
## [bit//xor _.bit-xor]
## )
-## (def: (bit//shift-left [subjectO paramO])
+## (def: (bit//left-shift [subjectO paramO])
## Binary
## (|> (_.bit-shl paramO subjectO)
## runtimeT.bit//64))
@@ -171,8 +171,8 @@
## Binary
## (<op> paramO subjectO))]
-## [bit//shift-right _.bit-shr]
-## [bit//unsigned-shift-right runtimeT.bit//shift-right]
+## [bit//arithmetic-right-shift _.bit-shr]
+## [bit//logical-right-shift runtimeT.bit//logical-right-shift]
## )
## (def: bit-procs
@@ -183,9 +183,9 @@
## (install "and" (binary bit//and))
## (install "or" (binary bit//or))
## (install "xor" (binary bit//xor))
-## (install "shift-left" (binary bit//shift-left))
-## (install "unsigned-shift-right" (binary bit//unsigned-shift-right))
-## (install "shift-right" (binary bit//shift-right))
+## (install "left-shift" (binary bit//left-shift))
+## (install "logical-right-shift" (binary bit//logical-right-shift))
+## (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift))
## )))
## ## [[Arrays]]
diff --git a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux
index 66827025e..c7262a291 100644
--- a/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/php/runtime.jvm.lux
@@ -216,41 +216,7 @@
(_.then! @@product//right)
(_.then! @@sum//get)))
-## (def: full-32-bits (_.code "0xFFFFFFFF"))
-
-## (runtime: (bit//32 input)
-## (with-vars [capped]
-## (_.cond! (list [(|> input (_.> full-32-bits))
-## (_.return! (|> input (_.bit-and full-32-bits) bit//32))]
-## [(|> input (_.> (_.code "0x7FFFFFFF")))
-## ($_ _.then!
-## (_.set! (list capped)
-## (_.apply (list (|> (_.code "0x100000000")
-## (_.- input)))
-## (_.global "int")))
-## (_.if! (|> (@@ capped) (_.<= (_.int 2147483647)))
-## (_.return! (|> (@@ capped) (_.* (_.int -1))))
-## (_.return! (_.int -2147483648))))])
-## (_.return! input))))
-
-## (def: full-64-bits (_.code "0xFFFFFFFFFFFFFFFF"))
-
-## (runtime: (bit//64 input)
-## (with-vars [capped]
-## (_.cond! (list [(|> input (_.> full-64-bits))
-## (_.return! (|> input (_.bit-and full-64-bits) bit//64))]
-## [(|> input (_.> (_.code "0x7FFFFFFFFFFFFFFF")))
-## ($_ _.then!
-## (_.set! (list capped)
-## (_.apply (list (|> (_.code "0x10000000000000000")
-## (_.- input)))
-## (_.global "int")))
-## (_.if! (|> (@@ capped) (_.<= (_.code "9223372036854775807L")))
-## (_.return! (|> (@@ capped) (_.* (_.int -1))))
-## (_.return! (_.code "-9223372036854775808L"))))])
-## (_.return! input))))
-
-## (runtime: (bit//shift-right param subject)
+## (runtime: (bit//logical-right-shift param subject)
## (let [mask (|> (_.int 1)
## (_.bit-shl (_.- param (_.int 64)))
## (_.- (_.int 1)))]
@@ -261,9 +227,7 @@
## (def: runtime//bit
## Runtime
## ($_ _.then!
-## @@bit//32
-## @@bit//64
-## @@bit//shift-right))
+## @@bit//logical-right-shift))
## (runtime: (text//index subject param start)
## (with-vars [idx]
diff --git a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux
index c9ebd6fd7..c201c417c 100644
--- a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux
@@ -161,7 +161,7 @@
[bit//xor python.bit-xor]
)
-(def: (bit//shift-left [subjectO paramO])
+(def: (bit//left-shift [subjectO paramO])
Binary
(|> (python.bit-shl paramO subjectO)
runtimeT.bit//64))
@@ -171,8 +171,8 @@
Binary
(<op> paramO subjectO))]
- [bit//shift-right python.bit-shr]
- [bit//unsigned-shift-right runtimeT.bit//shift-right]
+ [bit//arithmetic-right-shift python.bit-shr]
+ [bit//logical-right-shift runtimeT.bit//logical-right-shift]
)
(def: bit-procs
@@ -183,9 +183,9 @@
(install "and" (binary bit//and))
(install "or" (binary bit//or))
(install "xor" (binary bit//xor))
- (install "shift-left" (binary bit//shift-left))
- (install "unsigned-shift-right" (binary bit//unsigned-shift-right))
- (install "shift-right" (binary bit//shift-right))
+ (install "left-shift" (binary bit//left-shift))
+ (install "logical-right-shift" (binary bit//logical-right-shift))
+ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift))
)))
## [[Arrays]]
diff --git a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux
index 5d0ea9186..65e864d91 100644
--- a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux
@@ -266,7 +266,7 @@
(python.set! (list remaining) (|> (@@ remaining) (python./ (python.int 2))))))
(python.return! (@@ count)))))
-(runtime: (bit//shift-right param subject)
+(runtime: (bit//logical-right-shift param subject)
(let [mask (|> (python.int 1)
(python.bit-shl (python.- param (python.int 64)))
(python.- (python.int 1)))]
@@ -280,9 +280,9 @@
@@bit//32
@@bit//64
@@bit//count
- @@bit//shift-right))
+ @@bit//logical-right-shift))
-(def: high (-> Expression Expression) (bit//shift-right (python.int 32)))
+(def: high (-> Expression Expression) (bit//logical-right-shift (python.int 32)))
(def: low (-> Expression Expression) (python.bit-and full-32-bits))
(runtime: (nat//< param subject)
@@ -331,8 +331,8 @@
(python.set! (list $sH) (high subject))
(python.set! (list $pL) (..low param))
(python.set! (list $pH) (high param))
- (python.set! (list $bottom) (bit//shift-right (python.int 32)
- (python.* (@@ $pL) (@@ $sL))))
+ (python.set! (list $bottom) (bit//logical-right-shift (python.int 32)
+ (python.* (@@ $pL) (@@ $sL))))
(python.set! (list $middle) (python.+ (python.* (@@ $pL) (@@ $sH))
(python.* (@@ $pH) (@@ $sL))))
(python.set! (list $top) (python.* (@@ $pH) (@@ $sH)))
@@ -349,7 +349,7 @@
(python.while! (python.not (python.= (python.int 0) (@@ remaining)))
($_ python.then!
(python.set! (list zeroes) (python.- (python.int 1) (@@ zeroes)))
- (python.set! (list remaining) (bit//shift-right (python.int 1) (@@ remaining)))))
+ (python.set! (list remaining) (bit//logical-right-shift (python.int 1) (@@ remaining)))))
(python.return! (@@ zeroes)))))
(runtime: (deg/// param subject)
diff --git a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux
index 5685ae05e..05d16f871 100644
--- a/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/r/eval.jvm.lux
@@ -94,9 +94,9 @@
high (get-int-32 (:! IntArrayVector high))
low (get-int-32 (:! IntArrayVector low))]]
(wrap (:! Int
- (n/+ (|> high (bit.shift-left +32))
+ (n/+ (|> high (bit.left-shift +32))
(if (i/< 0 (:! Int low))
- (|> low (bit.shift-left +32) (bit.shift-right +32))
+ (|> low (bit.left-shift +32) (bit.logical-right-shift +32))
low))))))
(def: (lux-object host-object)
diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
index bd11bca21..a9e661130 100644
--- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux
@@ -167,9 +167,9 @@
Binary
(<op> (runtimeT.int64-low paramO) subjectO))]
- [bit//shift-left runtimeT.bit//shift-left]
- [bit//signed-shift-right runtimeT.bit//signed-shift-right]
- [bit//shift-right runtimeT.bit//shift-right]
+ [bit//left-shift runtimeT.bit//left-shift]
+ [bit//arithmetic-right-shift runtimeT.bit//arithmetic-right-shift]
+ [bit//logical-right-shift runtimeT.bit//logical-right-shift]
)
(def: bit-procs
@@ -180,9 +180,9 @@
(install "and" (binary bit//and))
(install "or" (binary bit//or))
(install "xor" (binary bit//xor))
- (install "shift-left" (binary bit//shift-left))
- (install "unsigned-shift-right" (binary bit//shift-right))
- (install "shift-right" (binary bit//signed-shift-right))
+ (install "left-shift" (binary bit//left-shift))
+ (install "logical-right-shift" (binary bit//logical-right-shift))
+ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift))
)))
## [[Arrays]]
diff --git a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
index 7183815c7..88b40bcca 100644
--- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux
@@ -33,7 +33,7 @@
## else
(nat-to-int input)))
-(def: high-32 (bit.shift-right +32))
+(def: high-32 (bit.logical-right-shift +32))
(def: low-32 (|>> (bit.and (hex "+FFFFFFFF"))))
(def: #export (int value)
@@ -333,7 +333,7 @@
[(|> (@@ shift) (r.= (r.int 0)))
(@@ input)])
-(runtime: (bit//shift-left shift input)
+(runtime: (bit//left-shift shift input)
($_ r.then
(limit-shift! shift)
(r.cond (list (no-shift-clause shift input)
@@ -349,26 +349,26 @@
(r.bit-shl (|> (@@ shift) (r.- (r.int 32)))))]
(int//new high (r.int 0))))))
-(runtime: (bit//signed-shift-right-32 shift input)
+(runtime: (bit//arithmetic-right-shift-32 shift input)
(let [top-bit (|> (@@ input) (r.bit-and (r.int (hex "80000000"))))]
(|> (@@ input)
(r.bit-ushr (@@ shift))
(r.bit-or top-bit))))
-(runtime: (bit//signed-shift-right shift input)
+(runtime: (bit//arithmetic-right-shift shift input)
($_ r.then
(limit-shift! shift)
(r.cond (list (no-shift-clause shift input)
[(|> (@@ shift) (r.< (r.int 32)))
(let [mid (|> (int64-high (@@ input)) (r.bit-shl (|> (r.int 32) (r.- (@@ shift)))))
high (|> (int64-high (@@ input))
- (bit//signed-shift-right-32 (@@ shift)))
+ (bit//arithmetic-right-shift-32 (@@ shift)))
low (|> (int64-low (@@ input))
(r.bit-ushr (@@ shift))
(r.bit-or mid))]
(int//new high low))])
(let [low (|> (int64-high (@@ input))
- (bit//signed-shift-right-32 (|> (@@ shift) (r.- (r.int 32)))))
+ (bit//arithmetic-right-shift-32 (|> (@@ shift) (r.- (r.int 32)))))
high (r.if (|> (int64-high (@@ input)) (r.>= (r.int 0)))
(r.int 0)
(r.int -1))]
@@ -393,9 +393,9 @@
($_ r.then
(r.set! approximation
(|> (@@ subject)
- (bit//signed-shift-right (r.int 1))
+ (bit//arithmetic-right-shift (r.int 1))
(int/// (@@ param))
- (bit//shift-left (r.int 1))))
+ (bit//left-shift (r.int 1))))
(r.if (|> (@@ approximation) (int//= int//zero))
(r.if (negative? (@@ param))
int//one
@@ -627,7 +627,7 @@
(int//from-float (r.+ (bit//count-32 (int64-high (@@ input)))
(bit//count-32 (int64-low (@@ input))))))
-(runtime: (bit//shift-right shift input)
+(runtime: (bit//logical-right-shift shift input)
($_ r.then
(limit-shift! shift)
(r.cond (list (no-shift-clause shift input)
@@ -658,10 +658,10 @@
@@bit//not
@@bit//count-32
@@bit//count
- @@bit//shift-left
- @@bit//signed-shift-right-32
- @@bit//signed-shift-right
- @@bit//shift-right
+ @@bit//left-shift
+ @@bit//arithmetic-right-shift-32
+ @@bit//arithmetic-right-shift
+ @@bit//logical-right-shift
))
(runtime: (nat//< param subject)
@@ -686,7 +686,7 @@
short-circuit-check
[(|> (@@ parameter)
- (nat//< (|> (@@ subject) (bit//shift-right (r.int 1)))))
+ (nat//< (|> (@@ subject) (bit//logical-right-shift (r.int 1)))))
int//one])
(with-vars [result remainder approximate log2 approximate-result approximate-remainder delta]
($_ r.then
@@ -748,14 +748,14 @@
(r.set! sH (int//from-float (int64-high (@@ subject))))
(r.set! pL (int//from-float (int64-low (@@ param))))
(r.set! pH (int//from-float (int64-high (@@ param))))
- (let [bottom (bit//shift-right (r.int 32)
- (int//* (@@ pL) (@@ sL)))
+ (let [bottom (bit//logical-right-shift (r.int 32)
+ (int//* (@@ pL) (@@ sL)))
middle (int//+ (int//* (@@ pL) (@@ sH))
(int//* (@@ pH) (@@ sL)))
top (int//* (@@ pH) (@@ sH))]
(|> bottom
(int//+ middle)
- (bit//shift-right (r.int 32))
+ (bit//logical-right-shift (r.int 32))
(int//+ top))))))
(runtime: (deg//leading-zeroes input)
@@ -766,7 +766,7 @@
(r.while (|> (@@ remaining) (int//= int//zero) r.not)
($_ r.then
(r.set! zeroes (|> (@@ zeroes) (r.- (r.int 1))))
- (r.set! remaining (|> (@@ remaining) (bit//shift-right (r.int 1))))))
+ (r.set! remaining (|> (@@ remaining) (bit//logical-right-shift (r.int 1))))))
(@@ zeroes))))
(runtime: (deg/// param subject)
@@ -778,11 +778,11 @@
(r.apply (list (deg//leading-zeroes (@@ param))
(deg//leading-zeroes (@@ subject)))
(r.global "min")))
- (let [subject' (|> (@@ subject) (bit//shift-left (@@ min-shift)))
- param' (|> (@@ param) (bit//shift-left (@@ min-shift)) int64-high int//from-float)]
+ (let [subject' (|> (@@ subject) (bit//left-shift (@@ min-shift)))
+ param' (|> (@@ param) (bit//left-shift (@@ min-shift)) int64-high int//from-float)]
(|> subject'
(int/// param')
- (bit//shift-left (r.int 32))))))))
+ (bit//left-shift (r.int 32))))))))
(runtime: (deg//from-frac input)
(with-vars [two32 shifted]
diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux
index ccd2699ce..a13dae50b 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/procedure/common.jvm.lux
@@ -160,7 +160,7 @@
[bit//xor ruby.bit-xor]
)
-(def: (bit//shift-left [subjectO paramO])
+(def: (bit//left-shift [subjectO paramO])
Binary
(ruby.bit-and "0xFFFFFFFFFFFFFFFF"
(ruby.bit-shl paramO subjectO)))
@@ -170,8 +170,8 @@
Binary
(<op> paramO subjectO))]
- [bit//shift-right ruby.bit-shr]
- [bit//unsigned-shift-right runtimeT.bit//shift-right]
+ [bit//arithmetic-right-shift ruby.bit-shr]
+ [bit//logical-right-shift runtimeT.bit//logical-right-shift]
)
(def: bit//count
@@ -186,9 +186,9 @@
(install "and" (binary bit//and))
(install "or" (binary bit//or))
(install "xor" (binary bit//xor))
- (install "shift-left" (binary bit//shift-left))
- (install "unsigned-shift-right" (binary bit//unsigned-shift-right))
- (install "shift-right" (binary bit//shift-right))
+ (install "left-shift" (binary bit//left-shift))
+ (install "logical-right-shift" (binary bit//logical-right-shift))
+ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift))
)))
## [[Arrays]]
diff --git a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
index 1e1e4c53a..c3f2981e1 100644
--- a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux
@@ -165,7 +165,7 @@
(ruby.set! (list subject) (ruby./ (ruby.int 2) subject)))))
(ruby.return! "count"))))
-(runtime: (bit//shift-right param subject)
+(runtime: (bit//logical-right-shift param subject)
(let [mask (|> (ruby.int 1)
(ruby.bit-shl (ruby.- param (ruby.int 64)))
(ruby.- (ruby.int 1)))]
@@ -176,9 +176,9 @@
(def: runtime//bit
Runtime
(format @@bit//count
- @@bit//shift-right))
+ @@bit//logical-right-shift))
-(def: high (-> Expression Expression) (bit//shift-right (ruby.int 32)))
+(def: high (-> Expression Expression) (bit//logical-right-shift (ruby.int 32)))
(def: low (-> Expression Expression) (ruby.bit-and "0xFFFFFFFF"))
(runtime: (nat//< param subject)
@@ -220,8 +220,8 @@
(ruby.set! (list "sH") (high subject))
(ruby.set! (list "pL") (low param))
(ruby.set! (list "pH") (high param))
- (ruby.set! (list "bottom") (bit//shift-right (ruby.int 32)
- (ruby.* "pL" "sL")))
+ (ruby.set! (list "bottom") (bit//logical-right-shift (ruby.int 32)
+ (ruby.* "pL" "sL")))
(ruby.set! (list "middle") (ruby.+ (ruby.* "pL" "sH")
(ruby.* "pH" "sL")))
(ruby.set! (list "top") (ruby.* "pH" "sH"))
@@ -234,7 +234,7 @@
(ruby.block! (list (ruby.set! (list "zeroes") (ruby.int 64))
(ruby.while! (ruby.not (ruby.= (ruby.int 0) input))
(ruby.block! (list (ruby.set! (list "zeroes") (ruby.- (ruby.int 1) "zeroes"))
- (ruby.set! (list input) (bit//shift-right (ruby.int 1) input)))))
+ (ruby.set! (list input) (bit//logical-right-shift (ruby.int 1) input)))))
(ruby.return! "zeroes"))))
(runtime: (deg/// param subject)
diff --git a/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux
index 7387b6530..cd828e082 100644
--- a/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/scheme/procedure/common.jvm.lux
@@ -161,18 +161,18 @@
[bit//xor _.bit-xor]
)
-(def: (bit//shift-left [subjectO paramO])
+(def: (bit//left-shift [subjectO paramO])
Binary
(_.arithmetic-shift (_.remainder (_.int 64) paramO) subjectO))
-(def: (bit//signed-shift-right [subjectO paramO])
+(def: (bit//arithmetic-right-shift [subjectO paramO])
Binary
(_.arithmetic-shift (|> paramO (_.remainder (_.int 64)) (_.* (_.int -1)))
subjectO))
-(def: (bit//shift-right [subjectO paramO])
+(def: (bit//logical-right-shift [subjectO paramO])
Binary
- (runtimeT.bit//shift-right (_.remainder (_.int 64) paramO) subjectO))
+ (runtimeT.bit//logical-right-shift (_.remainder (_.int 64) paramO) subjectO))
(def: bit-procs
Bundle
@@ -182,9 +182,9 @@
(install "and" (binary bit//and))
(install "or" (binary bit//or))
(install "xor" (binary bit//xor))
- (install "shift-left" (binary bit//shift-left))
- (install "unsigned-shift-right" (binary bit//shift-right))
- (install "shift-right" (binary bit//signed-shift-right))
+ (install "left-shift" (binary bit//left-shift))
+ (install "logical-right-shift" (binary bit//logical-right-shift))
+ (install "arithmetic-right-shift" (binary bit//arithmetic-right-shift))
)))
## [[Arrays]]
diff --git a/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux
index 816f92389..09259c2b9 100644
--- a/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/scheme/runtime.jvm.lux
@@ -225,7 +225,7 @@
@@product//right
@@sum//get)))
-(runtime: (bit//shift-right shift input)
+(runtime: (bit//logical-right-shift shift input)
(_.if (_.= (_.int 0) (@@ shift))
(@@ input)
(|> (@@ input)
@@ -234,9 +234,9 @@
(def: runtime//bit
Runtime
- (_.begin (list @@bit//shift-right)))
+ (_.begin (list @@bit//logical-right-shift)))
-(def: int-high (bit//shift-right (_.int 32)))
+(def: int-high (bit//logical-right-shift (_.int 32)))
(def: int-low (_.bit-and (_.int (hex "FFFFFFFF"))))
(runtime: (nat//< param subject)
@@ -254,7 +254,7 @@
(_.int 1))
(with-vars [quotient]
(_.let (list [quotient (|> (@@ subject)
- (bit//shift-right (_.int 1))
+ (bit//logical-right-shift (_.int 1))
(_.quotient (@@ param))
(_.arithmetic-shift (_.int 1)))])
(let [remainder (_.- (_.* (@@ param) (@@ quotient))