On 05/26/2011 09:14 PM, Blue Swirl wrote:
x = (int32_t)x>> (int32_t)y;
>>>
>> This expression has an implementation-defined behavior accroding to
>> C99 6.5.7 so we decided to emulate signed shifts by hand.
>
> Technically, yes. In practice, no. GCC, ICC, LLVM, MSVC all know
> what the user wants here and will implement it "properly".
Can't this be probed by configure? Then a wrapper could be introduced
for signed shifts.
The reason for implementation-defined behavior is basically to allow for
non-two's-complement machine, which isn't really practical to support.
Paolo