Hi!
For a long time I used the bsr opcode to get the highest set bit.
But this opcode is only suitable for integers up to 32 bit length.
Now I need an equivalent command for integers up to 64 bit.
Is there such a command for x64-CPU? If so, how to use it?
So far I use the 32-bit variant like this:
Code:
Procedure GetHighestBit(value.l)
! MOV eax, [p.v_value]
! bsr eax, eax
ProcedureReturn
EndProcedure
Note: the used CPU handles only
ARCH64, CLFSH, (F)CMOV, CX8, CX16, FXSR, MMX, MONITOR,
MSR, PAE, POPCNT, RDTSC, RDTSCP, SEP, SMX, SSE, SSE2,
SSE3, SSSE3, SSE4.1, SSE4.2, VMX
So no AVX and higher command sets are supported.
Second question:
How do I pass a variable in a structure and get the result back
in this structure? The structure could look like this:
Code:
Structure K
A.i
B.i
A.I.
D.i
EndStructure
The procedure should get the variable by K\A and return the result in K\B.
Currently the result is returned directly from the eax via ProcedureReturn.