From 48f11e1d8394b516b778a0e76c5d29bf64492261 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 13 Feb 2019 18:43:17 -0400 Subject: Re-named "logical-right-shift" to "logic-right-shift". --- stdlib/source/lux/data/collection/dictionary.lux | 2 +- stdlib/source/lux/data/collection/row.lux | 12 ++++++------ stdlib/source/lux/data/number/frac.lux | 2 +- stdlib/source/lux/data/number/i64.lux | 12 ++++++------ stdlib/source/lux/math/random.lux | 6 +++--- stdlib/source/lux/world/binary.lux | 22 +++++++++++----------- stdlib/source/test/lux.lux | 21 +++++++++++++++------ 7 files changed, 43 insertions(+), 34 deletions(-) diff --git a/stdlib/source/lux/data/collection/dictionary.lux b/stdlib/source/lux/data/collection/dictionary.lux index fb63dba48..3a670642c 100644 --- a/stdlib/source/lux/data/collection/dictionary.lux +++ b/stdlib/source/lux/data/collection/dictionary.lux @@ -159,7 +159,7 @@ (def: (level-index level hash) (-> Level Hash-Code Index) (i64.and hierarchy-mask - (i64.logical-right-shift level hash))) + (i64.logic-right-shift level hash))) ## A mechanism to go from indices to bit-positions. (def: (->bit-position index) diff --git a/stdlib/source/lux/data/collection/row.lux b/stdlib/source/lux/data/collection/row.lux index 87af1ee16..1e74054e5 100644 --- a/stdlib/source/lux/data/collection/row.lux +++ b/stdlib/source/lux/data/collection/row.lux @@ -71,7 +71,7 @@ (if (n/< full-node-size vec-size) 0 (|> (dec vec-size) - (i64.logical-right-shift branching-exponent) + (i64.logic-right-shift branching-exponent) (i64.left-shift branching-exponent)))) (def: (new-path level tail) @@ -89,7 +89,7 @@ (def: (push-tail size level tail parent) (All [a] (-> Nat Level (Base a) (Hierarchy a) (Hierarchy a))) - (let [sub-idx (branch-idx (i64.logical-right-shift level (dec size))) + (let [sub-idx (branch-idx (i64.logic-right-shift level (dec size))) ## If we're currently on a bottom node sub-node (if (n/= branching-exponent level) ## Just add the tail to it @@ -118,7 +118,7 @@ (def: (put' level idx val hierarchy) (All [a] (-> Level Index a (Hierarchy a) (Hierarchy a))) - (let [sub-idx (branch-idx (i64.logical-right-shift level idx))] + (let [sub-idx (branch-idx (i64.logic-right-shift level idx))] (case (array.read sub-idx hierarchy) (#.Some (#Hierarchy sub-node)) (|> (array.clone hierarchy) @@ -136,7 +136,7 @@ (def: (pop-tail size level hierarchy) (All [a] (-> Nat Level (Hierarchy a) (Maybe (Hierarchy a)))) - (let [sub-idx (branch-idx (i64.logical-right-shift level (n/- 2 size)))] + (let [sub-idx (branch-idx (i64.logic-right-shift level (n/- 2 size)))] (cond (n/= 0 sub-idx) #.None @@ -204,7 +204,7 @@ ## -------------------------------------------------------- ## Will the root experience an overflow with this addition? (|> (if (n/> (i64.left-shift (get@ #level vec) 1) - (i64.logical-right-shift branching-exponent vec-size)) + (i64.logic-right-shift branching-exponent vec-size)) ## If so, a brand-new root must be established, that is ## 1-level taller. (|> vec @@ -234,7 +234,7 @@ (loop [level (get@ #level vec) hierarchy (get@ #root vec)] (case [(n/> branching-exponent level) - (array.read (branch-idx (i64.logical-right-shift level idx)) hierarchy)] + (array.read (branch-idx (i64.logic-right-shift level idx)) hierarchy)] [#1 (#.Some (#Hierarchy sub))] (recur (level-down level) sub) diff --git a/stdlib/source/lux/data/number/frac.lux b/stdlib/source/lux/data/number/frac.lux index a2bd659b0..9c3380116 100644 --- a/stdlib/source/lux/data/number/frac.lux +++ b/stdlib/source/lux/data/number/frac.lux @@ -399,7 +399,7 @@ [(def: (|> 1 (//i64.left-shift ) dec (//i64.left-shift ))) (def: ( input) (-> (I64 Any) I64) - (|> input (//i64.and ) (//i64.logical-right-shift ) i64))] + (|> input (//i64.and ) (//i64.logic-right-shift ) i64))] [mantissa mantissa-mask mantissa-size 0] [exponent exponent-mask exponent-size mantissa-size] diff --git a/stdlib/source/lux/data/number/i64.lux b/stdlib/source/lux/data/number/i64.lux index fff288998..93d95f02c 100644 --- a/stdlib/source/lux/data/number/i64.lux +++ b/stdlib/source/lux/data/number/i64.lux @@ -27,7 +27,7 @@ ( param subject))] [left-shift "lux i64 left-shift" "Bitwise left-shift."] - [logical-right-shift "lux i64 logical-right-shift" "Unsigned bitwise logical-right-shift."] + [logic-right-shift "lux i64 logical-right-shift" "Unsigned bitwise logic-right-shift."] [arithmetic-right-shift "lux i64 arithmetic-right-shift" "Signed bitwise arithmetic-right-shift."] ) @@ -37,15 +37,15 @@ (def: (add-shift shift value) (-> Nat Nat Nat) - (|> value (logical-right-shift shift) (n/+ value))) + (|> value (logic-right-shift shift) (n/+ value))) (def: #export (count subject) {#.doc "Count the number of 1s in a bit-map."} (-> (I64 Any) Nat) - (let [count' (n/- (|> subject (logical-right-shift 1) (..and 6148914691236517205) i64) + (let [count' (n/- (|> subject (logic-right-shift 1) (..and 6148914691236517205) i64) (i64 subject))] (|> count' - (logical-right-shift 2) (..and 3689348814741910323) (n/+ (..and 3689348814741910323 count')) + (logic-right-shift 2) (..and 3689348814741910323) (n/+ (..and 3689348814741910323 count')) (add-shift 4) (..and 1085102592571150095) (add-shift 8) (add-shift 16) @@ -88,8 +88,8 @@ ( backwards-distance) (..or (
distance input)))))] - [rotate-left left-shift logical-right-shift] - [rotate-right logical-right-shift left-shift] + [rotate-left left-shift logic-right-shift] + [rotate-right logic-right-shift left-shift] ) (def: #export (region size offset) diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index 1d694d7e7..1d0d03b8e 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -274,11 +274,11 @@ (-> [(I64 Any) (I64 Any)] PRNG) (function (_ _) [(|> seed .nat (n/* pcg-32-magic-mult) ("lux i64 +" inc) [inc] pcg-32) - (let [rot (|> seed .i64 (i64.logical-right-shift 59))] + (let [rot (|> seed .i64 (i64.logic-right-shift 59))] (|> seed - (i64.logical-right-shift 18) + (i64.logic-right-shift 18) (i64.xor seed) - (i64.logical-right-shift 27) + (i64.logic-right-shift 27) (i64.rotate-right rot) .i64))])) diff --git a/stdlib/source/lux/world/binary.lux b/stdlib/source/lux/world/binary.lux index 7ccc9e1cb..72d1775c4 100644 --- a/stdlib/source/lux/world/binary.lux +++ b/stdlib/source/lux/world/binary.lux @@ -111,7 +111,7 @@ (-> Nat (I64 Any) Binary (Error Binary)) (if (n/< (..!size binary) (n/+ 1 idx)) (exec (|> binary - (host.array-write idx (..byte (i64.logical-right-shift 8 value))) + (host.array-write idx (..byte (i64.logic-right-shift 8 value))) (host.array-write (n/+ 1 idx) (..byte value))) (#error.Success binary)) (ex.throw index-out-of-bounds [(..!size binary) idx]))) @@ -120,9 +120,9 @@ (-> Nat (I64 Any) Binary (Error Binary)) (if (n/< (..!size binary) (n/+ 3 idx)) (exec (|> binary - (host.array-write idx (..byte (i64.logical-right-shift 24 value))) - (host.array-write (n/+ 1 idx) (..byte (i64.logical-right-shift 16 value))) - (host.array-write (n/+ 2 idx) (..byte (i64.logical-right-shift 8 value))) + (host.array-write idx (..byte (i64.logic-right-shift 24 value))) + (host.array-write (n/+ 1 idx) (..byte (i64.logic-right-shift 16 value))) + (host.array-write (n/+ 2 idx) (..byte (i64.logic-right-shift 8 value))) (host.array-write (n/+ 3 idx) (..byte value))) (#error.Success binary)) (ex.throw index-out-of-bounds [(..!size binary) idx]))) @@ -131,13 +131,13 @@ (-> Nat (I64 Any) Binary (Error Binary)) (if (n/< (..!size binary) (n/+ 7 idx)) (exec (|> binary - (host.array-write idx (..byte (i64.logical-right-shift 56 value))) - (host.array-write (n/+ 1 idx) (..byte (i64.logical-right-shift 48 value))) - (host.array-write (n/+ 2 idx) (..byte (i64.logical-right-shift 40 value))) - (host.array-write (n/+ 3 idx) (..byte (i64.logical-right-shift 32 value))) - (host.array-write (n/+ 4 idx) (..byte (i64.logical-right-shift 24 value))) - (host.array-write (n/+ 5 idx) (..byte (i64.logical-right-shift 16 value))) - (host.array-write (n/+ 6 idx) (..byte (i64.logical-right-shift 8 value))) + (host.array-write idx (..byte (i64.logic-right-shift 56 value))) + (host.array-write (n/+ 1 idx) (..byte (i64.logic-right-shift 48 value))) + (host.array-write (n/+ 2 idx) (..byte (i64.logic-right-shift 40 value))) + (host.array-write (n/+ 3 idx) (..byte (i64.logic-right-shift 32 value))) + (host.array-write (n/+ 4 idx) (..byte (i64.logic-right-shift 24 value))) + (host.array-write (n/+ 5 idx) (..byte (i64.logic-right-shift 16 value))) + (host.array-write (n/+ 6 idx) (..byte (i64.logic-right-shift 8 value))) (host.array-write (n/+ 7 idx) (..byte value))) (#error.Success binary)) (ex.throw index-out-of-bounds [(..!size binary) idx]))) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index d754862a8..391526efb 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -26,6 +26,20 @@ [host [js (#+)] [scheme (#+)]] + [tool + [compiler + [phase + [translation + [js + [runtime (#+)] + [primitive (#+)] + [structure (#+)] + [reference (#+)]] + [scheme + [runtime (#+)] + [primitive (#+)] + [structure (#+)] + [reference (#+)]]]]]] ## [control ## ["._" contract] ## ["._" concatenative] @@ -62,17 +76,12 @@ ## ["._" environment] ## ["._" console]] ## [compiler - ## [host - ## [".H" scheme]] ## ["._" cli] ## ["._" default ## ["._" evaluation] ## [phase ## ["._" translation ## [scheme - ## ["._scheme" primitive] - ## ["._scheme" structure] - ## ["._scheme" reference] ## ["._scheme" function] ## ["._scheme" loop] ## ["._scheme" case] @@ -289,7 +298,7 @@ (def: frac-rev (r.Random Rev) (|> r.rev - (:: r.functor map (|>> (i64.left-shift 11) (i64.logical-right-shift 11))))) + (:: r.functor map (|>> (i64.left-shift 11) (i64.logic-right-shift 11))))) (def: prelude-macros Test -- cgit v1.2.3