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.

On May 21, 7:39 pm, CuppoJava <patrickli_2...@hotmail.com> wrote:
> Hi everyone,
> I'm just wondering where the equivalent of the ">>>" operator is for
> Clojure. I need it to do a divide-by-power-of-2 on unsigned bytes.
>   -Patrick
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to