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/lua/runtime.jvm.lux | |
parent | febfa99c2823219c2e76d2c73b1fd8db8f6c9918 (diff) |
- Implemented bit-count in pure Lux.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/lua/runtime.jvm.lux | 11 |
1 files changed, 1 insertions, 10 deletions
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))))) |