|
970 | 970 | :added "1.0"} |
971 | 971 | [x] (. clojure.lang.Numbers (dec x))) |
972 | 972 |
|
973 | | -(defn unchecked-inc |
974 | | - "Returns a number one greater than x, an int or long. |
| 973 | +(defn unchecked-inc-int |
| 974 | + "Returns a number one greater than x, an int. |
975 | 975 | Note - uses a primitive operator subject to overflow." |
976 | | - {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_inc ~x))) |
| 976 | + {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_int_inc ~x))) |
977 | 977 | :added "1.0"} |
978 | | - [x] (. clojure.lang.Numbers (unchecked_inc x))) |
| 978 | + [x] (. clojure.lang.Numbers (unchecked_int_inc x))) |
979 | 979 |
|
980 | | -(defn unchecked-dec |
981 | | - "Returns a number one less than x, an int or long. |
| 980 | +(defn unchecked-inc-long |
| 981 | + "Returns a number one greater than x, a long. |
982 | 982 | Note - uses a primitive operator subject to overflow." |
983 | | - {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_dec ~x))) |
| 983 | + {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_long_inc ~x))) |
984 | 984 | :added "1.0"} |
985 | | - [x] (. clojure.lang.Numbers (unchecked_dec x))) |
| 985 | + [x] (. clojure.lang.Numbers (unchecked_long_inc x))) |
986 | 986 |
|
987 | | -(defn unchecked-negate |
988 | | - "Returns the negation of x, an int or long. |
| 987 | +(defn unchecked-dec-int |
| 988 | + "Returns a number one less than x, an int. |
989 | 989 | Note - uses a primitive operator subject to overflow." |
990 | | - {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_negate ~x))) |
| 990 | + {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_int_dec ~x))) |
991 | 991 | :added "1.0"} |
992 | | - [x] (. clojure.lang.Numbers (unchecked_negate x))) |
| 992 | + [x] (. clojure.lang.Numbers (unchecked_int_dec x))) |
993 | 993 |
|
994 | | -(defn unchecked-add |
995 | | - "Returns the sum of x and y, both int or long. |
| 994 | +(defn unchecked-dec-long |
| 995 | + "Returns a number one less than x, a long. |
996 | 996 | Note - uses a primitive operator subject to overflow." |
997 | | - {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_add ~x ~y))) |
| 997 | + {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_long_dec ~x))) |
998 | 998 | :added "1.0"} |
999 | | - [x y] (. clojure.lang.Numbers (unchecked_add x y))) |
| 999 | + [x] (. clojure.lang.Numbers (unchecked_long_dec x))) |
1000 | 1000 |
|
1001 | | -(defn unchecked-subtract |
1002 | | - "Returns the difference of x and y, both int or long. |
| 1001 | +(defn unchecked-negate-int |
| 1002 | + "Returns the negation of x, an int. |
1003 | 1003 | Note - uses a primitive operator subject to overflow." |
1004 | | - {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_subtract ~x ~y))) |
| 1004 | + {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_int_negate ~x))) |
1005 | 1005 | :added "1.0"} |
1006 | | - [x y] (. clojure.lang.Numbers (unchecked_subtract x y))) |
| 1006 | + [x] (. clojure.lang.Numbers (unchecked_int_negate x))) |
1007 | 1007 |
|
1008 | | -(defn unchecked-multiply |
1009 | | - "Returns the product of x and y, both int or long. |
| 1008 | +(defn unchecked-negate-long |
| 1009 | + "Returns the negation of x, a long. |
1010 | 1010 | Note - uses a primitive operator subject to overflow." |
1011 | | - {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_multiply ~x ~y))) |
| 1011 | + {:inline (fn [x] `(. clojure.lang.Numbers (unchecked_long_negate ~x))) |
1012 | 1012 | :added "1.0"} |
1013 | | - [x y] (. clojure.lang.Numbers (unchecked_multiply x y))) |
| 1013 | + [x] (. clojure.lang.Numbers (unchecked_long_negate x))) |
1014 | 1014 |
|
1015 | | -(defn unchecked-divide |
1016 | | - "Returns the division of x by y, both int or long. |
| 1015 | +(defn unchecked-add-int |
| 1016 | + "Returns the sum of x and y, both int. |
| 1017 | + Note - uses a primitive operator subject to overflow." |
| 1018 | + {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_int_add ~x ~y))) |
| 1019 | + :added "1.0"} |
| 1020 | + [x y] (. clojure.lang.Numbers (unchecked_int_add x y))) |
| 1021 | + |
| 1022 | +(defn unchecked-add-long |
| 1023 | + "Returns the sum of x and y, both long. |
| 1024 | + Note - uses a primitive operator subject to overflow." |
| 1025 | + {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_long_add ~x ~y))) |
| 1026 | + :added "1.0"} |
| 1027 | + [x y] (. clojure.lang.Numbers (unchecked_long_add x y))) |
| 1028 | + |
| 1029 | +(defn unchecked-subtract-int |
| 1030 | + "Returns the difference of x and y, both int. |
| 1031 | + Note - uses a primitive operator subject to overflow." |
| 1032 | + {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_int_subtract ~x ~y))) |
| 1033 | + :added "1.0"} |
| 1034 | + [x y] (. clojure.lang.Numbers (unchecked_int_subtract x y))) |
| 1035 | + |
| 1036 | +(defn unchecked-subtract-long |
| 1037 | + "Returns the difference of x and y, both long. |
| 1038 | + Note - uses a primitive operator subject to overflow." |
| 1039 | + {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_long_subtract ~x ~y))) |
| 1040 | + :added "1.0"} |
| 1041 | + [x y] (. clojure.lang.Numbers (unchecked_long_subtract x y))) |
| 1042 | + |
| 1043 | +(defn unchecked-multiply-int |
| 1044 | + "Returns the product of x and y, both int. |
| 1045 | + Note - uses a primitive operator subject to overflow." |
| 1046 | + {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_int_multiply ~x ~y))) |
| 1047 | + :added "1.0"} |
| 1048 | + [x y] (. clojure.lang.Numbers (unchecked_int_multiply x y))) |
| 1049 | + |
| 1050 | +(defn unchecked-multiply-long |
| 1051 | + "Returns the product of x and y, both long. |
| 1052 | + Note - uses a primitive operator subject to overflow." |
| 1053 | + {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_long_multiply ~x ~y))) |
| 1054 | + :added "1.0"} |
| 1055 | + [x y] (. clojure.lang.Numbers (unchecked_long_multiply x y))) |
| 1056 | + |
| 1057 | +(defn unchecked-divide-int |
| 1058 | + "Returns the division of x by y, both int. |
| 1059 | + Note - uses a primitive operator subject to truncation." |
| 1060 | + {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_int_divide ~x ~y))) |
| 1061 | + :added "1.0"} |
| 1062 | + [x y] (. clojure.lang.Numbers (unchecked_int_divide x y))) |
| 1063 | + |
| 1064 | +(defn unchecked-divide-long |
| 1065 | + "Returns the division of x by y, both long. |
| 1066 | + Note - uses a primitive operator subject to truncation." |
| 1067 | + {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_long_divide ~x ~y))) |
| 1068 | + :added "1.0"} |
| 1069 | + [x y] (. clojure.lang.Numbers (unchecked_long_divide x y))) |
| 1070 | + |
| 1071 | +(defn unchecked-remainder-int |
| 1072 | + "Returns the remainder of division of x by y, both int. |
1017 | 1073 | Note - uses a primitive operator subject to truncation." |
1018 | | - {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_divide ~x ~y))) |
| 1074 | + {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_int_remainder ~x ~y))) |
1019 | 1075 | :added "1.0"} |
1020 | | - [x y] (. clojure.lang.Numbers (unchecked_divide x y))) |
| 1076 | + [x y] (. clojure.lang.Numbers (unchecked_int_remainder x y))) |
1021 | 1077 |
|
1022 | | -(defn unchecked-remainder |
1023 | | - "Returns the remainder of division of x by y, both int or long. |
| 1078 | +(defn unchecked-remainder-long |
| 1079 | + "Returns the remainder of division of x by y, both long. |
1024 | 1080 | Note - uses a primitive operator subject to truncation." |
1025 | | - {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_remainder ~x ~y))) |
| 1081 | + {:inline (fn [x y] `(. clojure.lang.Numbers (unchecked_long_remainder ~x ~y))) |
1026 | 1082 | :added "1.0"} |
1027 | | - [x y] (. clojure.lang.Numbers (unchecked_remainder x y))) |
| 1083 | + [x y] (. clojure.lang.Numbers (unchecked_long_remainder x y))) |
1028 | 1084 |
|
1029 | 1085 | (defn pos? |
1030 | 1086 | "Returns true if num is greater than zero, else false" |
|
2183 | 2239 | [bindings & body] |
2184 | 2240 | (let [i (first bindings) |
2185 | 2241 | n (second bindings)] |
2186 | | - `(let [n# (int ~n)] |
| 2242 | + `(let [n# ~n] |
2187 | 2243 | (loop [~i (int 0)] |
2188 | 2244 | (when (< ~i n#) |
2189 | 2245 | ~@body |
2190 | | - (recur (inc ~i))))))) |
| 2246 | + (recur (unchecked-inc-long ~i))))))) |
2191 | 2247 |
|
2192 | 2248 | (defn map |
2193 | 2249 | "Returns a lazy sequence consisting of the result of applying f to the |
|
2553 | 2609 | {:tag 'clojure.lang.IChunk}) |
2554 | 2610 | count- (gensym "count_") |
2555 | 2611 | i- (gensym "i_") |
2556 | | - recform `(recur (next ~seq-) nil (int 0) (int 0)) |
| 2612 | + recform `(recur (next ~seq-) nil 0 0) |
2557 | 2613 | steppair (step recform (nnext exprs)) |
2558 | 2614 | needrec (steppair 0) |
2559 | 2615 | subform (steppair 1) |
2560 | 2616 | recform-chunk |
2561 | | - `(recur ~seq- ~chunk- ~count- (unchecked-inc ~i-)) |
| 2617 | + `(recur ~seq- ~chunk- ~count- (unchecked-inc-long ~i-)) |
2562 | 2618 | steppair-chunk (step recform-chunk (nnext exprs)) |
2563 | 2619 | subform-chunk (steppair-chunk 1)] |
2564 | 2620 | [true |
2565 | 2621 | `(loop [~seq- (seq ~v), ~chunk- nil, |
2566 | | - ~count- (int 0), ~i- (int 0)] |
| 2622 | + ~count- 0, ~i- 0] |
2567 | 2623 | (if (< ~i- ~count-) |
2568 | 2624 | (let [~k (.nth ~chunk- ~i-)] |
2569 | 2625 | ~subform-chunk |
|
2660 | 2716 | (= 2 (count bindings)) "exactly 2 forms in binding vector") |
2661 | 2717 | (let [i (first bindings) |
2662 | 2718 | n (second bindings)] |
2663 | | - `(let [n# (int ~n)] |
2664 | | - (loop [~i (int 0)] |
| 2719 | + `(let [n# ~n] |
| 2720 | + (loop [~i 0] |
2665 | 2721 | (when (< ~i n#) |
2666 | 2722 | ~@body |
2667 | | - (recur (unchecked-inc ~i))))))) |
| 2723 | + (recur (unchecked-inc-long ~i))))))) |
2668 | 2724 |
|
2669 | 2725 | #_(defn into |
2670 | 2726 | "Returns a new coll consisting of to-coll with all of the items of |
|
3849 | 3905 | (= k :when) `(if ~v |
3850 | 3906 | ~(do-cmod etc) |
3851 | 3907 | (recur |
3852 | | - (unchecked-inc ~gi))) |
| 3908 | + (unchecked-inc-long ~gi))) |
3853 | 3909 | (keyword? k) |
3854 | 3910 | (err "Invalid 'for' keyword " k) |
3855 | 3911 | :else |
3856 | 3912 | `(do (chunk-append ~gb ~body-expr) |
3857 | | - (recur (unchecked-inc ~gi)))))] |
| 3913 | + (recur (unchecked-inc-long ~gi)))))] |
3858 | 3914 | `(fn ~giter [~gxs] |
3859 | 3915 | (lazy-seq |
3860 | 3916 | (loop [~gxs ~gxs] |
|
0 commit comments