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/js | |
parent | 3e2fddc6bfdda56dbe6947c476f85760b0811654 (diff) |
- Implemented Deg functionality in pure Lux.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux | 34 | ||||
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux | 65 |
2 files changed, 0 insertions, 99 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux index f9e00be2a..28b993f91 100644 --- a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux @@ -219,9 +219,6 @@ [frac//not-a-number Double::NaN runtimeT.frac] [frac//positive-infinity Double::POSITIVE_INFINITY runtimeT.frac] [frac//negative-infinity Double::NEGATIVE_INFINITY runtimeT.frac] - - [deg//min 0 runtimeT.int] - [deg//max -1 runtimeT.int] ) (do-template [<name> <op>] @@ -234,14 +231,6 @@ [int//mul runtimeT.int//*] [int//div runtimeT.int///] [int//rem runtimeT.int//%] - - [deg//add runtimeT.int//+] - [deg//sub runtimeT.int//-] - [deg//mul runtimeT.deg//*] - [deg//div runtimeT.deg///] - [deg//rem runtimeT.int//-] - [deg//scale runtimeT.int//*] - [deg//reciprocal runtimeT.int///] ) (do-template [<name> <op>] @@ -268,8 +257,6 @@ [int//= runtimeT.int//=] [int//< runtimeT.int//<] - [deg//= runtimeT.int//=] - [deg//< runtimeT.int//<] ) (def: (frac//encode inputJS) @@ -289,8 +276,6 @@ [int//to-frac runtimeT.int//to-number] [frac//to-int runtimeT.int//from-number] - [frac//to-deg runtimeT.deg//from-frac] - [deg//to-frac runtimeT.deg//to-frac] [text//hash runtimeT.text//hash] ) @@ -475,23 +460,6 @@ (install "to-frac" (unary int//to-frac)) (install "char" (unary int//char))))) -(def: deg-procs - Bundle - (<| (prefix "deg") - (|> (dict.new text.Hash<Text>) - (install "+" (binary deg//add)) - (install "-" (binary deg//sub)) - (install "*" (binary deg//mul)) - (install "/" (binary deg//div)) - (install "%" (binary deg//rem)) - (install "=" (binary deg//=)) - (install "<" (binary deg//<)) - (install "scale" (binary deg//scale)) - (install "reciprocal" (binary deg//reciprocal)) - (install "min" (nullary deg//min)) - (install "max" (nullary deg//max)) - (install "to-frac" (unary deg//to-frac))))) - (def: frac-procs Bundle (<| (prefix "frac") @@ -509,7 +477,6 @@ (install "not-a-number" (nullary frac//not-a-number)) (install "positive-infinity" (nullary frac//positive-infinity)) (install "negative-infinity" (nullary frac//negative-infinity)) - (install "to-deg" (unary frac//to-deg)) (install "to-int" (unary frac//to-int)) (install "encode" (unary frac//encode)) (install "decode" (unary frac//decode))))) @@ -603,7 +570,6 @@ (|> lux-procs (dict.merge bit-procs) (dict.merge int-procs) - (dict.merge deg-procs) (dict.merge frac-procs) (dict.merge text-procs) (dict.merge array-procs) diff --git a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux index 5fab92941..a95268013 100644 --- a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux @@ -584,70 +584,6 @@ __int/// __int//%)) -(runtime: deg//* "mulD64" - (format "(function " @ "(l,r) {" - "var lL = " int//from-number "(l.L);" - "var rL = " int//from-number "(r.L);" - "var lH = " int//from-number "(l.H);" - "var rH = " int//from-number "(r.H);" - - "var bottom = " bit//logical-right-shift "(" int//* "(lL,rL),32);" - "var middle = " int//+ "(" int//* "(lH,rL)," int//* "(lL,rH));" - "var top = " int//* "(lH,rH);" - - "var bottomAndMiddle = " bit//logical-right-shift "(" int//+ "(middle,bottom),32);" - - "return " int//+ "(top,bottomAndMiddle);" - "})")) - -(runtime: deg//leading-zeroes "countLeadingZeroes" - (format "(function " @ "(input) {" - "var zeroes = 64;" - (format "while(!" int//= "(input," int//zero ")) {" - "zeroes--;" - "input = " bit//logical-right-shift "(input,1);" - "}") - "return zeroes;" - "})")) - -(runtime: deg/// "divD64" - (format "(function " @ "(l,r) {" - (format "if(" int//= "(l,r)) {" - "return " int//negate "(" int//one ");" ## ~= 1.0 DEG - "}" - "else {" - "var minShift = Math.min(" deg//leading-zeroes "(l), " deg//leading-zeroes "(r));" - "l = " bit//left-shift "(l,minShift);" - "r = " bit//left-shift "(r,minShift);" - "return " bit//left-shift "(" int/// "(l," int//from-number "(r.H)),32);" - "}") - "})")) - -(runtime: deg//to-frac "degToFrac" - (format "(function " @ "(input) {" - "var two32 = Math.pow(2,32);" - "var high = input.H / two32;" - "var low = (input.L / two32) / two32;" - "return high+low;" - "})")) - -(runtime: deg//from-frac "fracToDeg" - (format "(function " @ "(input) {" - "var two32 = Math.pow(2,32);" - "var shifted = (input % 1.0) * two32;" - "var low = ((shifted % 1.0) * two32) | 0;" - "var high = shifted | 0;" - "return " int//new "(high,low);" - "})")) - -(def: runtime//deg - Runtime - (format __deg//* - __deg//leading-zeroes - __deg/// - __deg//to-frac - __deg//from-frac)) - (runtime: text//index "index" (format "(function " @ "(text,part,start) {" "var idx = text.indexOf(part," int//to-number "(start));" @@ -807,7 +743,6 @@ runtime//adt runtime//bit runtime//int - runtime//deg runtime//text runtime//array runtime//io |