Mail Archives: djgpp/1998/07/11/17:16:51
On Sat, 11 Jul 1998 13:37:00 -0300, Endlisnis <s257m AT unb DOT ca> wrote:
>On Sat, 11 Jul 1998, Paul Shirley wrote:
>->>>I think these differ in how they uses the CARRY bit
>->
>->(Having realised << is a left shift;)
>->The reason you see SAL or SHL is that they are the same instruction,
>->given 2 names at the whim of some Intel engineer, used at the whim of
>->the compiler writers.
>->The carry (if that were the difference) would be irrelevant since C
>->source cannot see a carry, compiler writers can do what they like with
>->it.
> Wouldn't that mean that if you had a negative number shifted left
>a bunch of times you could end up with a positive?
Yes - and vice versa. Whenever the highest and second highest bits are
different, a <<1 will change the sign. This situation is defined as a
signed integer overflow.
Regards
Horst
- Raw text -