store/[org.clojure/clojure "1.8.0"] clj::clojure.core/bit-shift-right

Official Documentation

Add notes
Arities
==================================================
   [x n]

Docstring
==================================================
  Bitwise shift right

Source

(defn bit-shift-right
  "Bitwise shift right"
  {:inline (fn [x n] `(. clojure.lang.Numbers (shiftRight ~x ~n)))
   :added "1.0"}
  [x n] (. clojure.lang.Numbers shiftRight x n))

Example 1

Edit
(bit-shift-right 2r1101 0)
;; => 13

(bit-shift-right 2r1101 1)
;; => 6

(bit-shift-right 2r1101 2)
;; => 3

Example 2

Edit
;; Convert number into bits:
(defn bits [n s]
  (->> n
       (iterate (fn [i] (bit-shift-right i 1)))
       (map     (fn [i] (bit-and 0x01 i)))
       (take s)))
;; => #'user/bits

(map (fn [n] (bits n 3)) (range 8))
;; => ((0 0 0)
;;     (1 0 0)
;;     (0 1 0)
;;     (1 1 0)
;;     (0 0 1)
;;     (1 0 1)
;;     (0 1 1)
;;     (1 1 1))

Uses on crossclj