Re: [AD] Borland C++ compilation errors

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> The one below is independent from sizeof(long), or it can be done by
> comparing with (long) (((~(unsigned long) 0) >> 1) & ~0xFFFF)

Fixed numbers are explictly definined in the docs as "signed 32-bit
integers, ranging from -32768 to 32767". So I think we should check against
0x7FFF0000.

> It may not work on computers where negative numbers are made by simply
> inverting most significant bit, for example.

Do you know of such CPUs still existing nowadays ?
I remember programming on a 8-bit Motorola 6809 and it already used 2's
complement.

> IMHO, cast to (unsigned long) before shifting makes sure that it is simply
> bitshift with zero filling (though compilers might have their own ideas).

My docs clearly say ANSI C requires bitshifting with zero filling for
positive signed integers.

-Eric



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/