How to Shift Left a Negative Number??

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
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??

Post by hgm »

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??

Post by syzygy »

hgm wrote:Indeed, that is 32-bit code. Why should that matter? There are also 32-bit cmov instructions.
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.

Anyway, I agree in general that it makes sense to avoid branches or code that is likely to produce branches.