Re: [AD] Borland C++ compilation errors |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> int
> fceil (long v)
> {
> if (v < 0)
> return -(int) ((unsigned long) -v >> 16);
> else
> return (int) (((unsigned long) v + 0xFFFF) >> 16);
> }
This gives fceil(0x7FFF0001) = 0x8000, which is inconsistent with the x86
asm versions and the previous behaviour.
> int
> ffloor (long v)
> {
> if (v < 0)
> return -(int) (((unsigned long) -v + 0xFFFF) >> 16);
> else
> return (int) ((unsigned long) v >> 16);
> }
Ouch !
Why wouldn't my previous proposal work ? According to my references, it is
legal to do shifting on signed integers and the vacants bits are always
filled with zeros for positive ones.
--
Eric Botcazou
ebotcazou@xxxxxxxxxx