diff options
author | Eduardo Julian | 2018-05-06 03:30:47 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-05-06 03:30:47 -0400 |
commit | e65e734e5df3746ffb7df2cc9fa33826e0083fcd (patch) | |
tree | c67b1105a4b421d527804ccbfcab4d29ec20e744 /new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux | |
parent | f5a6fe62a612c0727063fa9e530d53ddda5fcd82 (diff) |
- Re-named shift-left -> left-shift, shift-right -> logical-right-shift, signed-shift-right -> arithmetic-right-shift.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux | 42 |
1 files changed, 21 insertions, 21 deletions
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] |