diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/world/blob.jvm.lux | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/stdlib/source/lux/world/blob.jvm.lux b/stdlib/source/lux/world/blob.jvm.lux index 0027a4750..077fa3863 100644 --- a/stdlib/source/lux/world/blob.jvm.lux +++ b/stdlib/source/lux/world/blob.jvm.lux @@ -23,7 +23,7 @@ (def: byte-mask Nat - (|> +1 (bit.shift-left +8) n/dec)) + (|> +1 (bit.left-shift +8) n/dec)) (def: byte-to-nat (-> (primitive "java.lang.Byte") Nat) @@ -43,7 +43,7 @@ (-> Nat Blob (e.Error Nat)) (if (n/< (host.array-length blob) (n/+ +1 idx)) (#e.Success ($_ bit.or - (bit.shift-left +8 (byte-to-nat (host.array-read idx blob))) + (bit.left-shift +8 (byte-to-nat (host.array-read idx blob))) (byte-to-nat (host.array-read (n/+ +1 idx) blob)))) (ex.throw index-out-of-bounds (%n idx)))) @@ -51,9 +51,9 @@ (-> Nat Blob (e.Error Nat)) (if (n/< (host.array-length blob) (n/+ +3 idx)) (#e.Success ($_ bit.or - (bit.shift-left +24 (byte-to-nat (host.array-read idx blob))) - (bit.shift-left +16 (byte-to-nat (host.array-read (n/+ +1 idx) blob))) - (bit.shift-left +8 (byte-to-nat (host.array-read (n/+ +2 idx) blob))) + (bit.left-shift +24 (byte-to-nat (host.array-read idx blob))) + (bit.left-shift +16 (byte-to-nat (host.array-read (n/+ +1 idx) blob))) + (bit.left-shift +8 (byte-to-nat (host.array-read (n/+ +2 idx) blob))) (byte-to-nat (host.array-read (n/+ +3 idx) blob)))) (ex.throw index-out-of-bounds (%n idx)))) @@ -61,13 +61,13 @@ (-> Nat Blob (e.Error Nat)) (if (n/< (host.array-length blob) (n/+ +7 idx)) (#e.Success ($_ bit.or - (bit.shift-left +56 (byte-to-nat (host.array-read idx blob))) - (bit.shift-left +48 (byte-to-nat (host.array-read (n/+ +1 idx) blob))) - (bit.shift-left +40 (byte-to-nat (host.array-read (n/+ +2 idx) blob))) - (bit.shift-left +32 (byte-to-nat (host.array-read (n/+ +3 idx) blob))) - (bit.shift-left +24 (byte-to-nat (host.array-read (n/+ +4 idx) blob))) - (bit.shift-left +16 (byte-to-nat (host.array-read (n/+ +5 idx) blob))) - (bit.shift-left +8 (byte-to-nat (host.array-read (n/+ +6 idx) blob))) + (bit.left-shift +56 (byte-to-nat (host.array-read idx blob))) + (bit.left-shift +48 (byte-to-nat (host.array-read (n/+ +1 idx) blob))) + (bit.left-shift +40 (byte-to-nat (host.array-read (n/+ +2 idx) blob))) + (bit.left-shift +32 (byte-to-nat (host.array-read (n/+ +3 idx) blob))) + (bit.left-shift +24 (byte-to-nat (host.array-read (n/+ +4 idx) blob))) + (bit.left-shift +16 (byte-to-nat (host.array-read (n/+ +5 idx) blob))) + (bit.left-shift +8 (byte-to-nat (host.array-read (n/+ +6 idx) blob))) (byte-to-nat (host.array-read (n/+ +7 idx) blob)))) (ex.throw index-out-of-bounds (%n idx)))) @@ -83,7 +83,7 @@ (-> Nat Nat Blob (e.Error Top)) (if (n/< (host.array-length blob) (n/+ +1 idx)) (exec (|> blob - (host.array-write idx (host.long-to-byte (:! Int (bit.shift-right +8 value)))) + (host.array-write idx (host.long-to-byte (:! Int (bit.logical-right-shift +8 value)))) (host.array-write (n/+ +1 idx) (host.long-to-byte (:! Int value)))) (#e.Success [])) (ex.throw index-out-of-bounds (%n idx)))) @@ -92,9 +92,9 @@ (-> Nat Nat Blob (e.Error Top)) (if (n/< (host.array-length blob) (n/+ +3 idx)) (exec (|> blob - (host.array-write idx (host.long-to-byte (:! Int (bit.shift-right +24 value)))) - (host.array-write (n/+ +1 idx) (host.long-to-byte (:! Int (bit.shift-right +16 value)))) - (host.array-write (n/+ +2 idx) (host.long-to-byte (:! Int (bit.shift-right +8 value)))) + (host.array-write idx (host.long-to-byte (:! Int (bit.logical-right-shift +24 value)))) + (host.array-write (n/+ +1 idx) (host.long-to-byte (:! Int (bit.logical-right-shift +16 value)))) + (host.array-write (n/+ +2 idx) (host.long-to-byte (:! Int (bit.logical-right-shift +8 value)))) (host.array-write (n/+ +3 idx) (host.long-to-byte (:! Int value)))) (#e.Success [])) (ex.throw index-out-of-bounds (%n idx)))) @@ -103,13 +103,13 @@ (-> Nat Nat Blob (e.Error Top)) (if (n/< (host.array-length blob) (n/+ +7 idx)) (exec (|> blob - (host.array-write idx (host.long-to-byte (:! Int (bit.shift-right +56 value)))) - (host.array-write (n/+ +1 idx) (host.long-to-byte (:! Int (bit.shift-right +48 value)))) - (host.array-write (n/+ +2 idx) (host.long-to-byte (:! Int (bit.shift-right +40 value)))) - (host.array-write (n/+ +3 idx) (host.long-to-byte (:! Int (bit.shift-right +32 value)))) - (host.array-write (n/+ +4 idx) (host.long-to-byte (:! Int (bit.shift-right +24 value)))) - (host.array-write (n/+ +5 idx) (host.long-to-byte (:! Int (bit.shift-right +16 value)))) - (host.array-write (n/+ +6 idx) (host.long-to-byte (:! Int (bit.shift-right +8 value)))) + (host.array-write idx (host.long-to-byte (:! Int (bit.logical-right-shift +56 value)))) + (host.array-write (n/+ +1 idx) (host.long-to-byte (:! Int (bit.logical-right-shift +48 value)))) + (host.array-write (n/+ +2 idx) (host.long-to-byte (:! Int (bit.logical-right-shift +40 value)))) + (host.array-write (n/+ +3 idx) (host.long-to-byte (:! Int (bit.logical-right-shift +32 value)))) + (host.array-write (n/+ +4 idx) (host.long-to-byte (:! Int (bit.logical-right-shift +24 value)))) + (host.array-write (n/+ +5 idx) (host.long-to-byte (:! Int (bit.logical-right-shift +16 value)))) + (host.array-write (n/+ +6 idx) (host.long-to-byte (:! Int (bit.logical-right-shift +8 value)))) (host.array-write (n/+ +7 idx) (host.long-to-byte (:! Int value)))) (#e.Success [])) (ex.throw index-out-of-bounds (%n idx)))) |