[LLVMdev] Why is there no ashl/lshl?
Paul_Robinson at playstation.sony.com
Tue May 7 09:57:56 PDT 2013
> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
> On Behalf Of Duncan Sands
> Sent: Tuesday, May 07, 2013 1:05 AM
> To: llvmdev at cs.uiuc.edu
> Subject: Re: [LLVMdev] Why is there no ashl/lshl?
> Hi Tim,
> >> There is a distinction between logical/arithmetic shift right, but
> >> not for shift left?
> > The arithmetic right shift has the nice property that it preserves the
> > fact that x >> 1 == x/2 for negative signed numbers (unlike the
> > logical shift).
> except when x is -1.
x a>> 1 == (x/2 rounded toward negative infinity)
which for positive numbers people think of as "truncated"
which people sometimes mistake for "rounded toward zero"
More information about the llvm-dev