guile-user
[Top][All Lists]
Advanced

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

Re: unsigned-int


From: Mark H Weaver
Subject: Re: unsigned-int
Date: Fri, 23 Jun 2017 08:16:54 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Catonano <address@hidden> writes:

> 2017-06-22 18:20 GMT+02:00 Mark H Weaver <address@hidden>:
>
>> Given this, and
>> the fact that you're passing the wrong width, makes me surprised that
>> this is working for you at all.
>
>
> Mark, thank you so much for your review. I appreciate that
>
> I apologize if my questions are naive.

No, not at all.  I appreciate your work on guile-freexl.  My surprise
that it was working at all was not a judgement of you, rather it was a
sincere confusion, but now I understand.

The combination of two mistakes: (endianness big) and width 1, actually
had the effect of making this work for numbers small enough to fit in 1
byte, which means unsigned numbers between 0 and 255 and signed numbers
between -128 and 127.

> So, yeah, I'm sorry for the fuss

No need to apologize.

> All that said, I applied the fixes that you suggested and I still get
> completely wrong number of rows of the spreadsheets and correct number of
> columns
>
> Exactly as before your correctons

Except that now it will work for larger numbers, and on architectures
that are truly big endian, whereas before it wouldn't have.

> For now I renounced to extract  numbers from my bytevectors
> 
> The culprit is: #vu8(232 3 0 0)
> 
> There are 27 lines in the sheet, so this bytevector should represent 27,
> somehow.

On a little-endian architecture (which includes Intel and most other
popular architectures), #vu8(232 3 0 0) represents 1000.  If that's the
number you're getting, then that part of the code is working correctly.

> On another sheet in the same file, this is what happens:
> 
> (#vu8(118 0 0 0) #vu8(17 0))
> 
> The sheet has 17 columns indeed. And it has 23 rows :-/

#vu8(118 0 0 0) represents 118.

I'm not sure why it's a different number than you're expecting, but I
can tell you that's the number in that bytevector.

       Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]