-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fast-read-byte returns unexpected octet #26
Comments
You can't specify both a vector and a stream to be read from. (make-input-buffer :vector (make-octet-vector size) :stream stream) to (make-input-buffer :stream stream) |
I've had this issue before, and I can verify @CloseToZero's solution works. I assumed that the vector argument in (with-fast-input (buffer (make-array 4 :element-type '(unsigned-byte 8)) my-stream)
;; XXX: The first statement reads and exhausts the vector, and then the buffer reads from the stream.
(print (read32-le buffer)) ;; => 0
(print (read32-le buffer))) ;; => 32-bit number from stream... (with-fast-input (buffer nil my-stream)
;; OK
(print (read32-le buffer)) ;; => first 32-bit number from stream...
(print (read32-le buffer))) ;; => second 32-bit number, and so on |
😅 I overlook something in the source of |
More than an implementation detail, it's documented in the readme:
Same behavior for |
result:
test value: 12345
reading from file (without fast-io): 12345
reading from file (with fast-io): 0
The text was updated successfully, but these errors were encountered: