diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/data/number/i64.lux | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/stdlib/source/lux/data/number/i64.lux b/stdlib/source/lux/data/number/i64.lux index 249ae9046..8dfec1fc7 100644 --- a/stdlib/source/lux/data/number/i64.lux +++ b/stdlib/source/lux/data/number/i64.lux @@ -25,9 +25,9 @@ (All [s] (-> <parameter-type> (I64 s) (I64 s))) (<op> parameter subject))] - [(I64 Any) and "lux i64 and" "Bitwise and."] [(I64 Any) or "lux i64 or" "Bitwise or."] [(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 logic-right-shift "lux i64 logical-right-shift" "Unsigned bitwise logic-right-shift."] @@ -37,7 +37,7 @@ (def: #export not {#.doc "Bitwise negation."} (All [s] (-> (I64 s) (I64 s))) - (xor (:coerce I64 -1))) + (xor (.i64 (dec 0)))) (type: #export Mask I64) @@ -64,7 +64,7 @@ (def: #export sign Mask - (..bit 63)) + (..bit (dec ..width))) (def: (add-shift shift value) (-> Nat Nat Nat) @@ -102,6 +102,10 @@ (-> Nat (I64 Any) Bit) (|> input (:coerce I64) (..and (..bit idx)) (n.= 0) .not)) +(def: #export (clear? idx input) + (-> Nat (I64 Any) Bit) + (.not (..set? idx input))) + (template [<name> <main> <comp>] [(def: #export (<name> distance input) (All [s] (-> Nat (I64 s) (I64 s))) @@ -115,8 +119,8 @@ ) (def: #export (region size offset) - (-> Nat Nat I64) - (|> 1 (:coerce I64) (left-shift size) dec (left-shift offset))) + (-> Nat Nat Mask) + (..left-shift offset (..mask size))) (structure: #export equivalence (All [a] (Equivalence (I64 a))) |