flat assembler
Message board for the users of flat assembler.
Index
> Main > rol64 with 32bit register pair?? |
Author |
|
Tomasz Grysztar 23 Jan 2006, 11:18
If you need to rotate just by 1 bit, you can do it through carry:
Code: bt eax,31 ; CF := the highest bit of EAX rcl edx,1 rcl eax,1 To rotate by larger amount you'd have to use some intermediating register, perhaps with help of SHLD instruction. |
|||
23 Jan 2006, 11:18 |
|
Genix 23 Jan 2006, 13:07
So if i need to rotate by N bit, can i use cycle with rotation by 1 bit or can i rotate it at once?
|
|||
23 Jan 2006, 13:07 |
|
Genix 23 Jan 2006, 16:55
Tomasz Grysztar wrote: If you need to rotate just by 1 bit, you can do it through carry: Is it right? rol64start: mov ecx, 15 ; 15xrepeat bt eax, 31 cycle_start: rcl edx, 1 rcl eax, 1 loop cycle_start |
|||
23 Jan 2006, 16:55 |
|
Tomasz Grysztar 23 Jan 2006, 17:24
No, you are duplicating one bit this way - you would have to put the BT instruction also inside the loop.
Also, assuming you've got the shift count in CL, you can it without loop using SHLD, something like: Code: shld ebx,edx,cl shld edx,eax,cl ror ebx,cl shld eax,ebx,cl with EBX as a temporary storage. |
|||
23 Jan 2006, 17:24 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.