function/macro | since v0.0-927 | clojure.core/bit-and-not | Edit |
(bit-and-not x y)
(bit-and-not x y & more)
Bitwise "and" x
with bitwise "not" y
. Same as x & ~y
in JavaScript.
Bits can be entered using radix notation:
(bit-and-not 2r1100 2r1010)
;;=> 4
;; 4 = 2r0100
Same numbers in decimal:
(bit-and-not 12 10)
;;=> 4
Same result using bit-and
and bit-not
:
(bit-and 12 (bit-not 10))
;;=> 4
Bitwise and with complement
(defn bit-and-not
([x y] (cljs.core/bit-and-not x y))
([x y & more]
(reduce bit-and-not (cljs.core/bit-and-not x y) more)))
(core/defmacro ^::ana/numeric bit-and-not
([x y] (core/list 'js* "(~{} & ~~{})" x y))
([x y & more] `(bit-and-not (bit-and-not ~x ~y) ~@more)))