Add a clojure equivalent of >>>.
The patch implements a new unsigned-bit-shift-right function that has the semantics of Java long >>>. This differs in particular in the handling of the shift distance which uses the least significant 6 bits of the shift distance (thus always in the range 0-63 inclusive). A Java method Numbers.unsignedShiftRightInt is included but not used by the surfaced function.
Screened by: Alex Miller
Related ticket: Ticket CLJS-514 has been created to track the future work of making ClojureScript's name for this operation the same as the one used in Clojure, after this ticket is completed. David Nolen is agreeable to making this change, even though it would rename an already-defined public function.
For reference, notes on how Java does >>> for ints and longs is here:
I found that section particularly helpful wrt understanding the behavior of the shift distance parameter. Namely, that for longs the shift distance uses only the least significant 6 bits (bit-and with 0x3f) which explains some of the added tests using large or negative shift distances.
I made some additions to the description on the one patch that I think should be considered, and why, and comments on what appears to be the current state of the ClojureScript question. Feel free to edit further if it needs it.
AFAICT the newest two patches are relevant (Gabriel's patch – the latest one – applies on top of Tim's patch – second latest); the first one must have been left around as per the usual Clojure JIRA custom to leave historical patches in place.
As for ClojureScript, Gabriel's comment indicates that Rich expressed a preference for the name unsigned-bit-shift-right. ClojureScript can adjust to that no problem, in fact I think we should just switch the name ahead of time. There is no open question on the ClojureScript side except if Clojure actually merged the patches we'd be able to make any final adjustments and close the CLJS ticket.
NB. the adjustments to make there are only about the name of the function anyway, as explained in the comments above.
I'll also note that the present couple of patches (1) touch no existing behaviour, (2) add in a missing basic and useful operation which we cannot just simulate in Clojure if performance is a concern at all. Hence my long-standing +1 on this issue.
It's unclear to me what patches are in play and whether the Clojurescript question is resolved in this ticket. Can someone clean it up? Moving to Incomplete.
@Gabriel: I mean it's not marked private in ClojureScript, so ClojureScript already exports the ...-zero-fill name, technically speaking. As per David Nolen's comment on CLJS-514, this is probably not a big deal.