Skip to content
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

The function pack need to initail the elements of teh variable result to 0 #6

Open
wants to merge 71 commits into
base: master
Choose a base branch
from

Conversation

Yehouda
Copy link

@Yehouda Yehouda commented Mar 22, 2020

[edit: that ended in the wrong place apparently. It was supposed to be about mgi/binary-io ]

Inside the function pack the variable result is currently bound to (make-array m), which create a simple-vector with NILs. then the call to ldb gets NIL as third argument and errors. That happens when running the tests.

It needs to be initialized with Zeroes, by being bound to (make-array m :initial-element 0).

I am not actually pulling the code, I am just raising an issue. I do it in a pull request because I didn't find the issues for this project.

mgi added 30 commits March 14, 2017 17:50
a :reader, a :writer and a :size (or any combination of them). For
example:

;; Just a reader and a size for this unsigned integer
(define-binary-type unsigned-integer (bytes bits-per-byte)
  (:reader (in)
    (loop with value = 0
       for low-bit downfrom (* bits-per-byte (1- bytes)) to 0 by bits-per-byte do
         (setf (ldb (byte bits-per-byte low-bit) value) (read-byte in))
       finally (return value)))
  (:size () bytes))

A not present :reader, :writer or :size will error out at call time.
one can obtain the byte size of a binary class object.
size of a read-byte.

start to optimize a bit.
and now io stream should be of type '(unsigned-byte 8) for most
data-type.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants