From 07c70ad15ba4a8c9b00773a0a14eade28fe06569 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 7 May 2018 21:43:19 -0400 Subject: - Implemented bit-count in pure Lux. --- .../lang/translation/js/procedure/common.jvm.lux | 5 ----- .../luxc/lang/translation/js/runtime.jvm.lux | 25 ---------------------- 2 files changed, 30 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/js') 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) - (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)) -- cgit v1.2.3