Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: optimization question

Author: Oliver Roese

Date: 09:29:27 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

Since "(unsigned char) u" and "u & 0xff" are equivalent expressions in C (or
arent they??) and nearly equivalent in other languages you surely cant tell
that, without looking on the assembler output of your compiler.
In C dont ever use char, there are implicitely converted to ints and that could
hurt. If the compiler can decide not to convert, slow  86-instructions must be
used. Hard to tell, what is slowest.

Oliver



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.