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. --- .../luxc/lang/translation/r/procedure/common.jvm.lux | 1 - .../source/luxc/lang/translation/r/runtime.jvm.lux | 20 -------------------- 2 files changed, 21 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/r') diff --git a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux index 68b0bb67d..5c4909d9b 100644 --- a/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/procedure/common.jvm.lux @@ -176,7 +176,6 @@ Bundle (<| (prefix "bit") (|> (dict.new text.Hash) - (install "count" (unary runtimeT.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/r/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux index ced898662..5f073eb17 100644 --- a/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/r/runtime.jvm.lux @@ -609,24 +609,6 @@ [bit//xor r.bit-xor] ) -(runtime: (bit//count-32 input) - (with-vars [count] - ($_ r.then - (r.set! count (r.int 0)) - (let [last-input-bit (|> (@@ input) (r.bit-and (r.int 1))) - update-count! (r.set! count (|> (@@ count) (r.+ last-input-bit))) - consume-input! (r.set! input (|> (@@ input) (r.bit-ushr (r.int 1)))) - input-remaining? (|> (@@ input) (r.= (r.int 0)))] - (r.while input-remaining? - ($_ r.then - update-count! - consume-input!))) - (@@ count)))) - -(runtime: (bit//count input) - (int//from-float (r.+ (bit//count-32 (int64-high (@@ input))) - (bit//count-32 (int64-low (@@ input)))))) - (runtime: (bit//logical-right-shift shift input) ($_ r.then (limit-shift! shift) @@ -656,8 +638,6 @@ @@bit//or @@bit//xor @@bit//not - @@bit//count-32 - @@bit//count @@bit//left-shift @@bit//arithmetic-right-shift-32 @@bit//arithmetic-right-shift -- cgit v1.2.3