Welcome to the CHICKEN Scheme pasting service
u8bytes->number added by C-Keen on Sun Sep 4 16:19:04 2011
(define (bytes->number bytes signed?)
(let* ((hi (u8vector-ref bytes 0))
(lo (u8vector-ref bytes 1))
(u (fxior (fxshl hi 8) lo))
(s (if (bit-set? u 15) -1 1)))
(if signed?
(fx* s (fxand (fxnot (fxshl 1 15)) u))
u)))