It mirrors a whole ULongInt at once (bit by bit):
Code: Select all
#Macro mirror64(Variable)
If SizeOf(Variable) = 8 Then
#Ifdef __FB_64BIT__
Asm
mov rax, qword Ptr[Variable]
Xor rbx, rbx ' faster than: mov rbx, 0
mov rcx, 64
1:
rcr rax
rcl rbx
dec rcx
jnz 1b
mov qword Ptr[Variable], rbx
End Asm
#Else
Asm
mov eax, dword Ptr[Variable]
Xor ebx, ebx ' mov ebx, 0
mov ecx, 32
mov edx, ecx ' save it to unused reg (for next run)
1:
rcr eax
rcl ebx
dec ecx
jnz 1b
mov eax, dword Ptr[Variable + 4]
mov dword Ptr[Variable + 4], ebx
Xor ebx, ebx ' mov ebx, 0
mov ecx, edx ' restore '32'
2: ' <--- diff. label
rcr eax
rcl ebx
dec ecx
jnz 2b
mov dword Ptr[Variable], ebx
End Asm
#EndIf
EndIf
#EndMacro
Dim As ULongInt zahl = &h2233445566778899
Print Bin(zahl, 64), Hex(zahl, 16)
mirror64(zahl)
Print Bin(zahl, 64), Hex(zahl, 16)
mirror64(zahl)
Print Bin(zahl, 64), Hex(zahl, 16)
Sleep
@Luis,
now, you just have to decide, which one is the *one for you*.