Ray Racine
2008-02-14 03:13:52 UTC
;; first set bytevector to -1 then read it back, did not get expected -1
(let* ((bv (make-bytevector 4 0))
(show (lambda () (display bv)(newline))))
(newline)
(show)
(bytevector-s32-set! bv 0 -1 'little)
(show)
(bytevector-s32-ref bv 0 'little))
#vu8(0 0 0 0)
#vu8(255 255 255 127)
2147483647
---
;; ref a little endian int from #vu8(255 255 255 255) and get -1,
;; expected behavior
(let* ((bv (make-bytevector 4 255))
(show (lambda () (display bv)(newline))))
(newline)
(show)
(bytevector-s32-ref bv 0 'little))
#vu8(255 255 255 255)
-1
---
Ran across the above while writing a quick utility using Larceny's FFI
to IBM's MQ (mq-mgr on OS/390 mainframe) today. ?!?!?
This weekend I'll try and get around to sending out some quick patches
on some of these little bugs I've managed to stumble across.
(let* ((bv (make-bytevector 4 0))
(show (lambda () (display bv)(newline))))
(newline)
(show)
(bytevector-s32-set! bv 0 -1 'little)
(show)
(bytevector-s32-ref bv 0 'little))
#vu8(0 0 0 0)
#vu8(255 255 255 127)
2147483647
---
;; ref a little endian int from #vu8(255 255 255 255) and get -1,
;; expected behavior
(let* ((bv (make-bytevector 4 255))
(show (lambda () (display bv)(newline))))
(newline)
(show)
(bytevector-s32-ref bv 0 'little))
#vu8(255 255 255 255)
-1
---
Ran across the above while writing a quick utility using Larceny's FFI
to IBM's MQ (mq-mgr on OS/390 mainframe) today. ?!?!?
This weekend I'll try and get around to sending out some quick patches
on some of these little bugs I've managed to stumble across.