diff options
Diffstat (limited to 'stdlib/source/unsafe')
-rw-r--r-- | stdlib/source/unsafe/lux/data/binary.lux | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/stdlib/source/unsafe/lux/data/binary.lux b/stdlib/source/unsafe/lux/data/binary.lux index bc99f1f55..33d217c40 100644 --- a/stdlib/source/unsafe/lux/data/binary.lux +++ b/stdlib/source/unsafe/lux/data/binary.lux @@ -198,7 +198,7 @@ <jvm_value> <jvm_value> <jvm_value> (ffi.long_to_byte <jvm_value>) <jvm> (ffi.write! <index> <jvm_value> <it>)] - (`` (template: .public (with/1! index value it) + (`` (template: .public (has/1! index value it) [(.is ..Binary (.for (~~ (.static @.old)) <jvm> (~~ (.static @.jvm)) <jvm> @@ -230,47 +230,47 @@ ... Default (array.has! <index> (.|> <value> .int ("lux i64 and" (.int <byte>))) <it>)))]))) -(template: .public (with/2! index' value' it) +(template: .public (has/2! index' value' it) [(.let [index (.is .Nat index') value (.is (.I64 .Any) value')] (.|> it - (..with/1! index ("lux i64 right-shift" 8 value)) - (..with/1! ("lux i64 +" 1 index) value)))]) + (..has/1! index ("lux i64 right-shift" 8 value)) + (..has/1! ("lux i64 +" 1 index) value)))]) -(template: .public (with/4! index' value' it) +(template: .public (has/4! index' value' it) [(.let [index (.is .Nat index') value (.is (.I64 .Any) value')] (.|> it - (..with/1! index ("lux i64 right-shift" 24 value)) - (..with/1! ("lux i64 +" 1 index) ("lux i64 right-shift" 16 value)) - (..with/1! ("lux i64 +" 2 index) ("lux i64 right-shift" 8 value)) - (..with/1! ("lux i64 +" 3 index) value)))]) + (..has/1! index ("lux i64 right-shift" 24 value)) + (..has/1! ("lux i64 +" 1 index) ("lux i64 right-shift" 16 value)) + (..has/1! ("lux i64 +" 2 index) ("lux i64 right-shift" 8 value)) + (..has/1! ("lux i64 +" 3 index) value)))]) -(`` (template: .public (with/8! index' value' it) +(`` (template: .public (has/8! index' value' it) [(.let [index (.is .Nat index') value (.is (.I64 .Any) value')] (.for (~~ (.static @.scheme)) (.let [write_high (.is (.-> ..Binary ..Binary) - (.|>> (..with/1! index ("lux i64 right-shift" 56 value)) - (..with/1! ("lux i64 +" 1 index) ("lux i64 right-shift" 48 value)) - (..with/1! ("lux i64 +" 2 index) ("lux i64 right-shift" 40 value)) - (..with/1! ("lux i64 +" 3 index) ("lux i64 right-shift" 32 value)))) + (.|>> (..has/1! index ("lux i64 right-shift" 56 value)) + (..has/1! ("lux i64 +" 1 index) ("lux i64 right-shift" 48 value)) + (..has/1! ("lux i64 +" 2 index) ("lux i64 right-shift" 40 value)) + (..has/1! ("lux i64 +" 3 index) ("lux i64 right-shift" 32 value)))) write_low (.is (.-> ..Binary ..Binary) - (.|>> (..with/1! ("lux i64 +" 4 index) ("lux i64 right-shift" 24 value)) - (..with/1! ("lux i64 +" 5 index) ("lux i64 right-shift" 16 value)) - (..with/1! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value)) - (..with/1! ("lux i64 +" 7 index) value)))] + (.|>> (..has/1! ("lux i64 +" 4 index) ("lux i64 right-shift" 24 value)) + (..has/1! ("lux i64 +" 5 index) ("lux i64 right-shift" 16 value)) + (..has/1! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value)) + (..has/1! ("lux i64 +" 7 index) value)))] (.|> it write_high write_low)) (.|> it - (..with/1! index ("lux i64 right-shift" 56 value)) - (..with/1! ("lux i64 +" 1 index) ("lux i64 right-shift" 48 value)) - (..with/1! ("lux i64 +" 2 index) ("lux i64 right-shift" 40 value)) - (..with/1! ("lux i64 +" 3 index) ("lux i64 right-shift" 32 value)) - (..with/1! ("lux i64 +" 4 index) ("lux i64 right-shift" 24 value)) - (..with/1! ("lux i64 +" 5 index) ("lux i64 right-shift" 16 value)) - (..with/1! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value)) - (..with/1! ("lux i64 +" 7 index) value))))])) + (..has/1! index ("lux i64 right-shift" 56 value)) + (..has/1! ("lux i64 +" 1 index) ("lux i64 right-shift" 48 value)) + (..has/1! ("lux i64 +" 2 index) ("lux i64 right-shift" 40 value)) + (..has/1! ("lux i64 +" 3 index) ("lux i64 right-shift" 32 value)) + (..has/1! ("lux i64 +" 4 index) ("lux i64 right-shift" 24 value)) + (..has/1! ("lux i64 +" 5 index) ("lux i64 right-shift" 16 value)) + (..has/1! ("lux i64 +" 6 index) ("lux i64 right-shift" 8 value)) + (..has/1! ("lux i64 +" 7 index) value))))])) (with_expansions [<reference> (.is ..Binary reference') <sample> (.is ..Binary sample') @@ -307,9 +307,9 @@ (.loop (again [index 0]) (.if ("lux i64 <" (.int bytes) (.int index)) (.exec - (..with/1! ("lux i64 +" target_offset index) - (..bytes/1 ("lux i64 +" source_offset index) source) - target) + (..has/1! ("lux i64 +" target_offset index) + (..bytes/1 ("lux i64 +" source_offset index) source) + target) (again ("lux i64 +" 1 index))) target)))))) |