I have more information on this now, and it is definitely a bug in
Clojure -- defmacro within a let doesn't work correctly. Consider the
following file:
--- BEGIN foo1a.coj ---
(ns com.ksvanhorn.foo1a)
(let [dummy 0]
(defmacro add [ args] `(unchecked-add ~...@args))
(defmacro mul [ args]
Here's how I implemented the operator for ints:
(let [intmask (dec (bit-shift-left 1 32))]
(defmacro ushr [x n] `(int (bit-shift-right (bit-and ~intmask ~x)
~n
The (bit-and intmask x) expression effectively gives you the unsigned
equivalent of x. For bytes, use 255 instead of intmask.