Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: asm question

Author: Bruce Moreland

Date: 13:44:15 06/18/00

Go up one level in this thread


On June 18, 2000 at 15:25:23, James Robertson wrote:

>I cannot remember how to do a shift in assembler and save any bits shifted off.
>Specifically, I want to shift a 64-bit integer. What is the assembler equivalent
>of:
>
>unsigned __int64 x;
>x <<= shift;

If you are using MSVC, you can often answer these questions by compiling with
the -Fc option, and looking at the code.

It is possible that they do a function call to do this, but if they do it
inline, the answer is right in front of you.

Which brings up another issue.  Why are you messing with assembly code, which is
non-portable, more difficult to maintain than C, and these days very hard to
write so it goes faster than optimized C code?  If you are doing this because
you want to speed up a C function, make sure that you do some stop-watch timing
on the code before and after.  I suggest that if you can't detect any
difference, you put the C back.

bruce



This page took 0.01 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.