`unchecked-dec-int` decrements one numeric argument using 32-bit integer arithmetic. It casts the argument to a primitive `int`, returns an `int` result, and does not check for overflow. Use it when an algorithm needs `int` values and rollover is acceptable; the stated input contract limits values to the `int` range. section 5.14
Decrement and rollover
`(unchecked-dec-int 12)` returns `11`. At the lower boundary, `(unchecked-dec-int Integer/MIN_VALUE)` wraps to `Integer/MAX_VALUE` rather than producing a value below the 32-bit range. section 5.14 section 5.6
The `-int` suffix matters: `unchecked-dec` also permits rollover, but its result type follows numeric promotion rather than staying `int`. In an integer-coordinate line-drawing loop, `unchecked-dec-int` updates the vertical coordinate when the line moves downward. Prefer an ordinary decrement when unchecked rollover is not wanted. section 5.13 section 5.14
(defn to-points [x1 y1 x2 y2] (let [[^int x1 ^int y1 ^int x2 ^int y2] (adjust x1 x2 y1 y2) ; #1 dx (unchecked-subtract-int x2 x1) dy (Math/abs (unchecked-subtract-int y1 y2))] (map (swap (steep? x1 x2 y1 y2)) (loop [x x1 ; #2 y y1 error (unchecked-divide-int dx 2) points []] (if (> x x2) points (if (< error dy) (recur (unchecked-inc-int x) ; #3 (if (< y1 y2) (unchecked-inc-int y) (unchecked-dec-int y)) (unchecked-add-int error (unchecked-subtract-int dx dy)) (conj points [x y])) (recur (unchecked-inc-int x) y (unchecked-subtract-int error dy) (conj points [x y]))))))))
The point-generation loop uses `unchecked-dec-int` for a downward step, alongside other `-int` operators for coordinate arithmetic. section 5.14
