Details
-
Type:
Enhancement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: Release 1.6
-
Component/s: None
-
Labels:None
-
Patch:Code
-
Approval:Vetted
Description
Add a clojure equivalent of >>>.
A simple version of this is implemented here (https://github.com/joegallo/clojure/tree/unsigned-bit-shift-right), and just follows the example set by shift-right.
The downside of this implementation is that it treats all integer types as longs, and shifts them accordingly, which yields different results than you would get in java. A previous version of this did not have the same problem, when BitOps was its own thing. I'm not sure if this limitation is acceptable and appropriate, or needs to be worked around (my inclination is the latter).
I just realized (with the asssistance of Paul Stadig) that just doing only longs is probably sufficient, as you can get the integer version if you really want it:
> (int (bit-and Integer/MAX_VALUE (unsigned-bit-shift-right -5 1)))
2147483645
Of course, that's less efficient than just doing it directly with java, but it's enough that I think my concern from the previous comment is addressed.