How to Shift Left a Negative Number??
Moderator: Ras
-
hgm
- Posts: 28425
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: How to Shift Left a Negative Number??
Indeed, that is 32-bit code. Why should that matter? There are also 32-bit cmov instructions.
-
syzygy
- Posts: 5807
- Joined: Tue Feb 28, 2012 11:56 pm
Re: How to Shift Left a Negative Number??
Well, even the 64-bit shifts are done with a branch in the code that your gcc produces, so in this situation there is no help anyway.hgm wrote:Indeed, that is 32-bit code. Why should that matter? There are also 32-bit cmov instructions.
Anyway, I agree in general that it makes sense to avoid branches or code that is likely to produce branches.