aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/lua
diff options
context:
space:
mode:
authorEduardo Julian2018-05-07 21:43:19 -0400
committerEduardo Julian2018-05-07 21:43:19 -0400
commit07c70ad15ba4a8c9b00773a0a14eade28fe06569 (patch)
tree18d6e938cb0a79ecffddd64da1958de47d75ee0f /new-luxc/source/luxc/lang/translation/lua
parentfebfa99c2823219c2e76d2c73b1fd8db8f6c9918 (diff)
- Implemented bit-count in pure Lux.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux5
-rw-r--r--new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux11
2 files changed, 1 insertions, 15 deletions
diff --git a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
index d751c6781..3c8f94557 100644
--- a/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/procedure/common.jvm.lux
@@ -159,10 +159,6 @@
[bit//logical-right-shift runtimeT.bit//logical-right-shift]
)
-(def: bit//count
- Unary
- runtimeT.bit//count)
-
## [[Arrays]]
(def: (array//new sizeO)
Unary
@@ -422,7 +418,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/lua/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
index de2d574ec..03d84f400 100644
--- a/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux
@@ -184,18 +184,9 @@
(lua.bit-shr param)
(lua.bit-and mask)))))
-(runtime: (bit//count subject)
- (lua.block! (list (lua.local! "count" (#.Some (lua.int 0)))
- (lua.while! (lua.> (lua.int 0) subject)
- (lua.block! (list (lua.set! "count" (lua.+ (lua.% (lua.int 2) subject)
- "count"))
- (lua.set! subject (lua.// (lua.int 2) subject)))))
- (lua.return! "count"))))
-
(def: runtime//bit
Runtime
- (format @@bit//count
- @@bit//logical-right-shift))
+ @@bit//logical-right-shift)
(runtime: (text//index subject param start)
(lua.block! (list (lua.local! "idx" (#.Some (lua.apply "string.find" (list subject param start (lua.bool true)))))