From 4326d69ab717683449bf37bf8dd170c83455c0c0 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 30 Mar 2022 19:23:12 -0400 Subject: Lined-up names of "safe" binary/array defs with names of "unsafe" ones. --- stdlib/source/unsafe/lux/data/binary.lux | 58 ++++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'stdlib/source/unsafe') 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 @@ (ffi.long_to_byte ) (ffi.write! )] - (`` (template: .public (with/1! index value it) + (`` (template: .public (has/1! index value it) [(.is ..Binary (.for (~~ (.static @.old)) (~~ (.static @.jvm)) @@ -230,47 +230,47 @@ ... Default (array.has! (.|> .int ("lux i64 and" (.int ))) )))]))) -(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 [ (.is ..Binary reference') (.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)))))) -- cgit v1.2.3