Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: asm question

Author: Bas Hamstra

Date: 16:57:18 06/18/00

Go up one level in this thread


On June 18, 2000 at 17:08:54, James Robertson wrote:

>On June 18, 2000 at 16:08:20, Robert Hyatt wrote:
>
>>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;
>>>
>>>Thanks,
>>>James
>>
>>
>>I don't follow.  x <<= shift simply shifts x "shift" bits to the left and
>>gives you the result.  Not the bits shifted off.  To get the bits you are
>>going to shift off, create a mask with "shift" bits in the left-most end,
>>AND this with the value, and then save them.  Those are the bits that would
>>have been lost.
>
>I guess my message is unclear. What I meant to say is: how do you do a shift of
>a 64-bit integer with a 32-bit processor? I think you must use two shift
>operations, one for the lower 32 bits, and one for the upper 32 bits.
>Unfortunately, I don't know how to do the shift on the lower 32 bits and move
>any bits shifted off the end of the lower 32 bit integer into the upper 32 bit
>integer.
>
>James

Again:

asm shld REG, REG, cl

does that. But using it always is not optimal.




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.