diff options
| author | Eduardo Julian | 2020-11-07 00:29:40 -0400 | 
|---|---|---|
| committer | Eduardo Julian | 2020-11-07 00:29:40 -0400 | 
| commit | 2e5852abb1ac0ae5abdd8709238aca447f62520e (patch) | |
| tree | 1b73a24205217c9e00f7f17d5972f67735a7cc69 /luxc | |
| parent | ef78c1f92ab29c4370193591b170535dd9e743f7 (diff) | |
Pure-Lux implementation for biggest and smallest Frac values.
Diffstat (limited to 'luxc')
| -rw-r--r-- | luxc/src/lux/analyser/proc/common.clj | 16 | ||||
| -rw-r--r-- | luxc/src/lux/compiler/jvm/proc/common.clj | 35 | 
2 files changed, 9 insertions, 42 deletions
diff --git a/luxc/src/lux/analyser/proc/common.clj b/luxc/src/lux/analyser/proc/common.clj index 267ea3465..6a1521909 100644 --- a/luxc/src/lux/analyser/proc/common.clj +++ b/luxc/src/lux/analyser/proc/common.clj @@ -195,19 +195,6 @@    analyse-frac-encode ["f64" "encode"] analyse-frac-decode ["f64" "decode"] &type/Frac    ) -(do-template [<name> <type> <op>] -  (defn- <name> [analyse exo-type ?values] -    (|do [:let [(&/$Nil) ?values] -          _ (&type/check exo-type <type>) -          _location &/location] -      (return (&/|list (&&/|meta exo-type _location -                                 (&&/$proc (&/T <op>) (&/|list) (&/|list))))))) - -  analyse-frac-smallest           &type/Frac ["f64"  "smallest"] -  analyse-frac-min                &type/Frac ["f64"  "min"] -  analyse-frac-max                &type/Frac ["f64"  "max"] -  ) -  (do-template [<name> <from-type> <to-type> <op>]    (defn- <name> [analyse exo-type ?values]      (|do [:let [(&/$Cons x (&/$Nil)) ?values] @@ -300,9 +287,6 @@           "lux f64 <" (analyse-frac-lt analyse exo-type ?values)           "lux f64 encode" (analyse-frac-encode analyse exo-type ?values)           "lux f64 decode" (analyse-frac-decode analyse exo-type ?values) -         "lux f64 smallest" (analyse-frac-smallest analyse exo-type ?values) -         "lux f64 min" (analyse-frac-min analyse exo-type ?values) -         "lux f64 max" (analyse-frac-max analyse exo-type ?values)           "lux f64 i64" (analyse-frac-int analyse exo-type ?values)           ;; Special extensions for performance reasons diff --git a/luxc/src/lux/compiler/jvm/proc/common.clj b/luxc/src/lux/compiler/jvm/proc/common.clj index d7023bae0..d4c825282 100644 --- a/luxc/src/lux/compiler/jvm/proc/common.clj +++ b/luxc/src/lux/compiler/jvm/proc/common.clj @@ -146,20 +146,6 @@    ^:private compile-frac-lt Opcodes/DCMPG -1 &&/unwrap-double    ) -(do-template [<name> <instr>] -  (defn <name> [compile ?values special-args] -    (|do [:let [(&/$Nil) ?values] -          ^MethodVisitor *writer* &/get-writer -          :let [_ (doto *writer* -                    (.visitLdcInsn <instr>) -                    &&/wrap-double)]] -      (return nil))) - -  ^:private compile-frac-smallest Double/MIN_VALUE -  ^:private compile-frac-min (* -1.0 Double/MAX_VALUE) -  ^:private compile-frac-max Double/MAX_VALUE -  ) -  (defn ^:private compile-frac-encode [compile ?values special-args]    (|do [:let [(&/$Cons ?input (&/$Nil)) ?values]          ^MethodVisitor *writer* &/get-writer @@ -458,19 +444,16 @@      "f64"      (case proc -      "+"         (compile-frac-add compile ?values special-args) -      "-"         (compile-frac-sub compile ?values special-args) -      "*"         (compile-frac-mul compile ?values special-args) -      "/"         (compile-frac-div compile ?values special-args) -      "%"         (compile-frac-rem compile ?values special-args) -      "="         (compile-frac-eq compile ?values special-args) -      "<"         (compile-frac-lt compile ?values special-args) -      "smallest" (compile-frac-smallest compile ?values special-args) -      "max" (compile-frac-max compile ?values special-args) -      "min" (compile-frac-min compile ?values special-args) +      "+"      (compile-frac-add compile ?values special-args) +      "-"      (compile-frac-sub compile ?values special-args) +      "*"      (compile-frac-mul compile ?values special-args) +      "/"      (compile-frac-div compile ?values special-args) +      "%"      (compile-frac-rem compile ?values special-args) +      "="      (compile-frac-eq compile ?values special-args) +      "<"      (compile-frac-lt compile ?values special-args)        "i64"    (compile-frac-int compile ?values special-args) -      "encode"    (compile-frac-encode compile ?values special-args) -      "decode"    (compile-frac-decode compile ?values special-args) +      "encode" (compile-frac-encode compile ?values special-args) +      "decode" (compile-frac-decode compile ?values special-args)        )      ;; else  | 
