Skip to content

clojure.core/bit-shift-right

View this page on ClojureDocs

Type: function Added: Clojure 1.0 Examples: 4 Runnable: 4
([x n])

Bitwise shift right

Examples

by devijvers on
by zmila on
by fasiha on
by Sophia-Gold on

Note by TimMc

From the IRC channel, a way to get zero-fill bit-shift-right:

06:08 < mikera> (defn >>> [v bits] (bit-shift-right (bit-and 0xFFFFFFFF v) bits))

There's also an open ticket for a built-in version.

Note by jafingerhut

unsigned-bit-shift-right was added in Clojure 1.6.0. Click the link in the See Also section above.

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.