4 ms·
That's because you're using crude programming languages. Sophisticated programming languages let you use arrays of bits, as well as manipulating bits in intege
by informatimago 14y ago
That's because you're using crude programming languages. Sophisticated programming languages let you use arrays of bits, as well as manipulating bits in integers.
(let ((a (make-array '(4 2) :element-type 'bit
:initial-contents '((1 1) (1 0) (0 1) (0 0))))
(b (make-array '(4 2) :element-type 'bit
:initial-contents '((1 0) (1 0) (1 0) (1 0)))))
(list (list a 'xor b '--> (bit-xor a b))
(list (aref a 0 1) 'xor (aref b 0 1) '--> (logxor (aref a 0 1) (aref b 0 1)))
(list #b1100 'xor #b1010 '--> (logxor #b1100 #b1010))))
--> ((#2A(#*11 #*10 #*01 #*00) xor #2A(#*10 #*10 #*10 #*10) --> #2A(#*01 #*00 #*11 #*10))
(1 xor 0 --> 1)
(12 xor 10 --> 6))