[Larceny-users] error peeking short values from raw memory
Felix Klock
felixluser at pnkfx.org
Fri Jul 3 14:46:23 EDT 2009
Marco-
On Jul 3, 2009, at 2:28 PM, Marco Maggi wrote:
> "Felix Klock" wrote:
>> Why are you subtracting 2 here when you've been
>> subtracting 1 in all the other cases?
>
> The form producing buggy output is:
>
>> (let ((v (- (expt 2 15) 1)))
>> (%poke16 a v)
>> (write (list v (%peek16 a)))
>> (newline))
>
> which prints (32767 -32769) where I expected (32767 32767).
> This one:
>
>> (let ((v (- (expt 2 15) 2)))
>> (%poke16 a v)
>> (write (list v (%peek16 a)))
>> (newline))
>
> correctly prints (32766 32766), I included it to show that
> the problem is only with 2^15-1.
Ah, I understand now. I did not read all the output you had included
carefully enough.
This looks like a fence-post error in the definition of %get16 in lib/
Base/std-ffi.sch to me, especially if one compares it to %get32
immediately following...
-Felix
More information about the Larceny-users
mailing list