That's a very elegant way of expressing it. Thanks for that tip Kevin.
-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 unsub
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 intmas
Like other mentioned in the thread, Java has neither the >>> operator,
nor unsigned data types.
With that said, I think the function you are looking for is bit-shift-
right:
user> (bit-shift-right 2r1110 1)
7
I hope this helps.
Vincent.
On May 21, 9:39 pm, CuppoJava wrote:
> Hi everyone,
> I
On Fri, May 22, 2009 at 5:17 PM, CuppoJava wrote:
>
> Wow that's news to me...
> I thought this was a fairly standard operator. I'm surprised that Java
> doesn't have a correct version of it.
I think the problem is that Java does not have unsigned bytes (or
other integer types).
e.g. see here:
Wow that's news to me...
I thought this was a fairly standard operator. I'm surprised that Java
doesn't have a correct version of it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this gr
On Fri 22/05/09 03:39 , "CuppoJava" patrickli_2...@hotmail.com sent:
>
> Hi everyone,
> I'm just wondering where the equivalent of the ">>>"
> operator is forClojure. I need it to do a divide-by-power-of-2 on unsigned
> bytes.
Java doesn't have this either. Its >>> operator doesn't work prop
On May 21, 2009, at 7:39 PM, CuppoJava 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.
I could use this too.
—
Daniel Lyons
http://www.storytotell.org -- Tell It!
--~--~---
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"