diff options
author | Eduardo Julian | 2018-05-07 21:43:19 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-05-07 21:43:19 -0400 |
commit | 07c70ad15ba4a8c9b00773a0a14eade28fe06569 (patch) | |
tree | 18d6e938cb0a79ecffddd64da1958de47d75ee0f /new-luxc/source/luxc/lang/translation/js | |
parent | febfa99c2823219c2e76d2c73b1fd8db8f6c9918 (diff) |
- Implemented bit-count in pure Lux.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux | 5 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux | 25 |
2 files changed, 0 insertions, 30 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux index 28b993f91..3e8ec79cf 100644 --- a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux @@ -168,10 +168,6 @@ [bit//logical-right-shift runtimeT.bit//logical-right-shift] ) -(def: (bit//count subjectJS) - Unary - (format runtimeT.bit//count "(" subjectJS ")")) - ## [[Arrays]] (def: (array//new sizeJS) Unary @@ -435,7 +431,6 @@ Bundle (<| (prefix "bit") (|> (dict.new text.Hash<Text>) - (install "count" (unary bit//count)) (install "and" (binary bit//and)) (install "or" (binary bit//or)) (install "xor" (binary bit//xor)) diff --git a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux index a95268013..1839a1a5e 100644 --- a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux @@ -287,29 +287,6 @@ "}") "})")) -(runtime: bit//count32 "countI32" - (let [last-input-bit "input & 1" - update-count! (format "count += " last-input-bit ";") - consume-input! "input = input >>> 1;" - input-remaining? "input !== 0"] - (format "(function " @ "(input) {" - "var count = 0;" - "while(" input-remaining? ") {" - update-count! - consume-input! - "}" - "return count;" - "})"))) - -(runtime: bit//count "countI64" - (let [high (format bit//count32 "(input.H)") - low (format bit//count32 "(input.L)") - whole (format "(" high " + " low ")") - cast (format int//from-number "(" whole ")")] - (format "(function " @ "(input) {" - "return " cast ";" - "})"))) - (runtime: bit//left-shift "shlI64" (format "(function " @ "(input,shift) {" "shift &= 63;" @@ -377,8 +354,6 @@ __bit//or __bit//xor __bit//not - __bit//count32 - __bit//count __bit//left-shift __bit//arithmetic-right-shift __bit//logical-right-shift)) |