diff options
author | Eduardo Julian | 2018-05-07 01:37:38 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-05-07 01:37:38 -0400 |
commit | febfa99c2823219c2e76d2c73b1fd8db8f6c9918 (patch) | |
tree | f521419a80b04f465c6c9c5020c2063e2e555895 /new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux | |
parent | 3e2fddc6bfdda56dbe6947c476f85760b0811654 (diff) |
- Implemented Deg functionality in pure Lux.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux index 7f66b0cd5..ac8f7b11a 100644 --- a/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/ruby/runtime.jvm.lux @@ -178,63 +178,6 @@ (format @@bit//count @@bit//logical-right-shift)) -(def: high (-> Expression Expression) (bit//logical-right-shift (ruby.int 32))) -(def: low (-> Expression Expression) (ruby.bit-and "0xFFFFFFFF")) - -(runtime: (deg//* param subject) - (ruby.block! (list (ruby.set! (list "sL") (low subject)) - (ruby.set! (list "sH") (high subject)) - (ruby.set! (list "pL") (low param)) - (ruby.set! (list "pH") (high param)) - (ruby.set! (list "bottom") (bit//logical-right-shift (ruby.int 32) - (ruby.* "pL" "sL"))) - (ruby.set! (list "middle") (ruby.+ (ruby.* "pL" "sH") - (ruby.* "pH" "sL"))) - (ruby.set! (list "top") (ruby.* "pH" "sH")) - (ruby.return! (|> "bottom" - (ruby.+ "middle") - high - (ruby.+ "top")))))) - -(runtime: (deg//leading-zeroes input) - (ruby.block! (list (ruby.set! (list "zeroes") (ruby.int 64)) - (ruby.while! (ruby.not (ruby.= (ruby.int 0) input)) - (ruby.block! (list (ruby.set! (list "zeroes") (ruby.- (ruby.int 1) "zeroes")) - (ruby.set! (list input) (bit//logical-right-shift (ruby.int 1) input))))) - (ruby.return! "zeroes")))) - -(runtime: (deg/// param subject) - (ruby.if! (ruby.= param subject) - (ruby.return! (ruby.int -1)) - (ruby.block! (list (ruby.set! (list "min_shift") - (ruby.send "min" (list) - (ruby.array (list (deg//leading-zeroes param) - (deg//leading-zeroes subject))))) - (ruby.return! (|> (ruby.bit-shl "min_shift" subject) - (ruby./ (|> param (ruby.bit-shl "min_shift") low)) - (ruby.bit-shl (ruby.int 32)))))))) - -(runtime: (deg//from-frac input) - (let [->int (ruby.send "floor" (list))] - (ruby.block! (list (ruby.set! (list "two32") (ruby.pow (ruby.float 32.0) (ruby.float 2.0))) - (ruby.set! (list "shifted") (|> input - (ruby.% (ruby.float 1.0)) - (ruby.* "two32"))) - (ruby.set! (list "low") (|> "shifted" - (ruby.% (ruby.float 1.0)) - (ruby.* "two32") - ->int)) - (ruby.set! (list "high") (|> "shifted" ->int)) - (ruby.return! (ruby.+ (ruby.bit-shl (ruby.int 32) "high") - "low")))))) - -(def: runtime//deg - Runtime - (format @@deg//* - @@deg//leading-zeroes - @@deg/// - @@deg//from-frac)) - (runtime: (text//index subject param start) (ruby.block! (list (ruby.set! (list "idx") (ruby.send "index" (list param start) subject)) (ruby.if! (ruby.= ruby.nil "idx") @@ -332,7 +275,6 @@ (format runtime//lux "\n" runtime//adt "\n" runtime//bit "\n" - runtime//deg "\n" runtime//text "\n" runtime//array "\n" runtime//atom "\n" |