From: Maarten B. <sou...@ds...> - 2006-09-28 10:36:07
|
Philipp, > I looked at different port's gen.c; some do arithmetic right shifts for > signed operands (pic16), some do logical shifts for both (z80), so I > assumed RIGHT_OP was undefined for signed left operands. > According to the C99 standard x >> y is implementation-defined for x <= 0 > (x << y is undefined for x < 0). I was not aware of that. > If there's a processor where logical shifts are faster than arithmetic > shifts, it would make sense to have different tokens, so arithmetic > shifts would be needed only to replace divisions. I would vote to make all ports always use an arithmetic shift for signed operands. If the user wants the faster logical shift he should use unsigned operands. Maarten |