[Coco] help with C problem
devries.bob at gmail.com
Mon Jan 2 17:10:35 EST 2006
As I said in my original post, I'm targetting this to the PC.
The problem was that I got caught by the Sign EXtend.
The CHAR vailue gets sign extended from 0xb0 (in my case) to the INTeger
value of 0xFFB0 which is negative, and is always less than 128! By ANDing it
with 0xFF, I make it positive again.
I also got caught with the PC BigEndian vs LittleEndian difference, but I've
cleared that up.
Regards, Bob Devries, Dalby, Queensland, Australia
Isaiah 50:4 The sovereign Lord has given me
the capacity to be his spokesman,
so that I know how to help the weary.
my blog: http://bdevries.invigorated.org/
----- Original Message -----
From: "tim lindner" <tlindner at ix.netcom.com>
To: <coco at maltedmedia.com>
Sent: Tuesday, January 03, 2006 3:45 AM
Subject: Re: [Coco] help with C problem
> Bob Devries <bdevries at gil.com.au> wrote:
>> The compiler always gives a warning in line 8: [Warning] comparison is
>> always true due to limited range of data type
> A char's range is -127 to 128. So the test of (s2 < 128) is _always_
> An unsigned char has a range of 0 to 255.
> If this is targeted to the CoCo, then I suggest testing if the high bit
> is not set, since there is not unsigned char.
> tim lindner
> tlindner at ix.netcom.com Bright
> Coco mailing list
> Coco at maltedmedia.com
More information about the Coco