diff options
Diffstat (limited to 'stdlib/source/library/lux/math/number/i64.lux')
-rw-r--r-- | stdlib/source/library/lux/math/number/i64.lux | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/stdlib/source/library/lux/math/number/i64.lux b/stdlib/source/library/lux/math/number/i64.lux index f11eee2f4..6ddd718ec 100644 --- a/stdlib/source/library/lux/math/number/i64.lux +++ b/stdlib/source/library/lux/math/number/i64.lux @@ -31,8 +31,8 @@ [(I64 Any) xor "lux i64 xor" "Bitwise xor."] [(I64 Any) and "lux i64 and" "Bitwise and."] - [Nat left_shift "lux i64 left-shift" "Bitwise left-shift."] - [Nat right_shift "lux i64 right-shift" "Unsigned/logic bitwise right-shift."] + [Nat left_shifted "lux i64 left-shift" "Bitwise left-shift."] + [Nat right_shifted "lux i64 right-shift" "Unsigned/logic bitwise right-shift."] ) (type: #export Mask @@ -40,7 +40,7 @@ (def: #export (bit position) (-> Nat Mask) - (|> 1 .i64 (..left_shift (n.% ..width position)))) + (|> 1 .i64 (..left_shifted (n.% ..width position)))) (def: #export sign Mask @@ -65,19 +65,19 @@ 0 ..false bits (case (n.% ..width bits) 0 ..true - bits (|> 1 .i64 (..left_shift (n.% ..width bits)) .dec)))) + bits (|> 1 .i64 (..left_shifted (n.% ..width bits)) .dec)))) (def: (add_shift shift value) (-> Nat Nat Nat) - (|> value (right_shift shift) (n.+ value))) + (|> value (right_shifted shift) (n.+ value))) (def: #export (count subject) {#.doc "Count the number of 1s in a bit-map."} (-> (I64 Any) Nat) - (let [count' (n.- (|> subject (right_shift 1) (..and 6148914691236517205) i64) + (let [count' (n.- (|> subject (right_shifted 1) (..and 6148914691236517205) i64) (i64 subject))] (|> count' - (right_shift 2) (..and 3689348814741910323) (n.+ (..and 3689348814741910323 count')) + (right_shifted 2) (..and 3689348814741910323) (n.+ (..and 3689348814741910323 count')) (add_shift 4) (..and 1085102592571150095) (add_shift 8) (add_shift 16) @@ -113,13 +113,13 @@ (..or (<forward> distance input) (<backward> (n.- (n.% ..width distance) ..width) input)))] - [rotate_left ..left_shift ..right_shift] - [rotate_right ..right_shift ..left_shift] + [left_rotated ..left_shifted ..right_shifted] + [right_rotated ..right_shifted ..left_shifted] ) (def: #export (region size offset) (-> Nat Nat Mask) - (..left_shift offset (..mask size))) + (..left_shifted offset (..mask size))) (implementation: #export equivalence (All [a] (Equivalence (I64 a))) @@ -149,7 +149,7 @@ (All [a] (-> (I64 a) (I64 a))) (let [swapper (: (-> Nat (All [a] (-> (I64 a) (I64 a)))) (function (_ power) - (let [size (..left_shift power 1) + (let [size (..left_shifted power 1) repetitions (: (-> Nat Text Text) (function (_ times char) (loop [iterations 1 @@ -164,10 +164,10 @@ (repetitions size "0"))) high (try.assumed (\ n.binary decode pattern)) - low (..rotate_right size high)] + low (..right_rotated size high)] (function (_ value) - (..or (..right_shift size (..and high value)) - (..left_shift size (..and low value))))))) + (..or (..right_shifted size (..and high value)) + (..left_shifted size (..and low value))))))) swap/01 (swapper 0) swap/02 (swapper 1) @@ -205,7 +205,7 @@ (def: &equivalence ..equivalence) (def: width width) (def: (narrow value) - (..or (|> value (..and ..sign) (..right_shift sign_shift)) + (..or (|> value (..and ..sign) (..right_shifted sign_shift)) (|> value (..and mantissa)))) (def: (widen value) (.i64 (case (.nat (..and sign value)) |