sal reg,variable

Discussions related to using the integrated assembler
Ric
Posts: 56
Joined: Tue 17 Apr 2018, 21:03

sal reg,variable

Post by Ric »

does anyone know if it is possible to shift a register by a variable instead of an immediate value?
eg
sal dword [mem], eax
I can always make a loop to do it but it would be nice if i could do it in one line.
Regards Ric

RichardRussell
Posts: 525
Joined: Tue 15 Oct 2019, 09:10

Re: sal reg,variable

Post by RichardRussell »

Ric wrote:
Tue 29 Sep 2020, 21:01
does anyone know if it is possible to shift a register by a variable instead of an immediate value?
Yes. In IA-32:

Code: Select all

0FA31CF9 D3 25 F3 20 A3 0F              sal dword [mem], cl
or in x86-64:

Code: Select all

000000000D791D17 D3 25 F4 03 00 00               sal dword [rel mem], cl
If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.

Ric
Posts: 56
Joined: Tue 17 Apr 2018, 21:03

Re: sal reg,variable

Post by Ric »

Thanks for the swift reply Richard