I'm from Germany, and in the german Version of the documentation SHARED the part regarding the strings is missing ...
@MichaelW and dodicat:
That's why I'd prefer rol and ror included in Freebasic. My ASM was likely the only one I could find with google at all. So, should I compile with -gas and include that code in my "patch" file, because it's the fastest way? I'm a litte new on all that stuff and I used only the standard options. Or have i to compile with different modules if I'm programming for Windows GUI?
But which should I take - thank you for all the variants, btw ...!
Code: Select all
function rol ( x as uinteger, y as uinteger ) as uinteger
asm
mov eax, [esp+4]
mov ecx, [esp+8]
rol eax, cl
ret 8
end asm
end function
function ror ( x as uinteger, y as uinteger ) as uinteger
asm
mov eax, [esp+4]
mov ecx, [esp+8]
ror eax, cl
ret 8
end asm
end function
Function roL2(N As Uinteger,S As Integer) As Uinteger
Return N Shl S Or N Shr (Sizeof(N)*8-S)
End Function
Function roR2(N As Uinteger,S As Integer) As Uinteger
Return N Shr S Or N Shl (Sizeof(N)*8-S)
End Function
And of course, the bigints are stored in binary strings (two's complement) and if you search your errors, you've to convert everything to hex to be able to print and check it. And because of the signed nature, there're actually two versions of the conversion to hex: a signed one which has leading zeros if the highest bit is set, but the number is positive, and a unsigned one which trims these leading zeroes to get a specific length. If I understood it correctly, on a 64bit platform integer is 64bit and not 32, and this would completely mash up my blocks - so I tended to ulong which is fixed to 32 bits, but not supported in hex(a,n). Or would it be better to change the types to uinteger<32> ? (but this is also not supported in hex(a,n) ).