Author: Walter Faxon
Date: 12:55:25 01/05/03
Go up one level in this thread
On January 04, 2003 at 23:32:43, Robert Hyatt wrote: >On January 04, 2003 at 15:32:40, Walter Faxon wrote: > >>On January 03, 2003 at 19:52:06, Matt Taylor wrote: <snip> >>>The compiler -should- recognize that 2 * to = to << 1 >> >>ONLY IF 'to' is guaranteed positive. Try: "2 * (unsigned)to". Or explicit >>shifting is always ok in my book. Use a comment or #if'ed-out debug code if you >>want to keep things clear. >> > >I'm missing something... > >-1<<1 is the same thing as -1*2... whether it is positive or negative does >not matter at all. <snip> Sorry. Leftshift always ok for integer multiply by power of 2. It's rightshift for divide by power of 2 that requires an unsigned operand. Mea culpa. -- Walter
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.