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. --- .../source/luxc/lang/translation/lua/procedure/common.jvm.lux | 5 ----- new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux | 11 +---------- 2 files changed, 1 insertion(+), 15 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/lua') 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) - (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))))) -- cgit v1.2.3