[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Style vectors



Just in case one of you tries to use the code that Bill St-Clair
sent yesterday about style vectors, I found a minor omission in it
that can take some time to figure out.

the third line of

        (setq next-offset 
              (+ (ash (logand (aref v (incf index 2)) #xff) 16)
                 (aref v (1+ index))))

which represents a word, happens to be in signed format, so
you have to unsign it to get the correct value (this will be
a problem only in files of size > 2^15 = 32768), i.e. replace
the third line by something like this

                 (let ((x (aref v (1+ index))))
                   (if (plusp x)
                       x
                     (+ 65536 x)))

Guillaume Cartier
LACIM, Universite du Quebec a Montreal.
Bureau: (514) 987-4290
E-Mail: cartier@math.uqam.ca