Author: Bruce Moreland
Date: 09:26:09 10/23/00
Go up one level in this thread
On October 23, 2000 at 01:09:02, Landon Rabern wrote: >is it faster to cast to a char or to AND by 0xff, or to do they take the same >number of clock cycles? > >Thanks, > >Landon W. Rabern If you want the bottom 8 bits, you are best off to just and with 0xFF. If you cast to char, it may sign-extend later if your compiler has signed chars. Also, regardless of whether it works or not, this is a dubious way to do what you suggest. Casting is something you do when you need to convert between data types, it's not supposed to be used as a unary mathematical operator. Another poster advised you to keep things in ints when you can, and that is good advice. "int" and "unsigned" are good types to use for arithmetic. bruce
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.