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