PicoLisp implementation of the BOAWP specification https://boawp.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
461 B

### Integer
(de _boawp-list-to-int (Lst)
(let N 0
(for B Lst
(setq N (| B (>> -8 N))) )
N ]
(de _boawp-int-to-list (Int)
(let Iter (size (>> 1 Int))
(link Iter)
(while (gt0 Iter)
(link (& (hex "ff") (>> (* (- Iter 1) 8) Int)))
(dec 'Iter) ]
(de _boawp-twos-complement (Int Size)
(if (lt0 Int)
(+ Int (>> (- Size) 1))
(if (=0 (& Int (>> (- (- Size 1)) 1)))
Int
(- Int (>> (- Size) 1)) ]