Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,26 @@
(defun bitwise (a b)
(lists:map
(lambda (x) (io:format "~p~n" `(,x)))
`(,(band a b)
,(bor a b)
,(bxor a b)
,(bnot a)
,(bsl a b)
,(bsr a b)))
'ok)
(defun dec->bin (x)
(integer_to_list x 2))
(defun describe (func arg1 arg2 result)
(io:format "(~s ~s ~s): ~s~n"
(list func (dec->bin arg1) (dec->bin arg2) (dec->bin result))))
(defun bitwise
((a b 'binary)
(describe "band" a b (band a b))
(describe "bor" a b (bor a b))
(describe "bxor" a b (bxor a b))
(describe "bnot" a b (bnot a))
(describe "bsl" a b (bsl a b))
(describe "bsr" a b (bsr a b))))

View file

@ -0,0 +1,17 @@
> (bitwise 255 170)
170
255
85
-256
381627307539845370001346183518875822092557105621893120
0
ok
> (bitwise 255 170 'binary)
(band 11111111 10101010): 10101010
(bor 11111111 10101010): 11111111
(bxor 11111111 10101010): 1010101
(bnot 11111111): -100000000
(bsl 11111111 10101010): 1111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
(bsr 11111111 10101010): 0
ok
>