(03-22-2025, 03:25 PM)SMcNeill Wrote: I figure it's mainly missing the type symbols and screwing with you with that.Thanks @SMcNeil, but I see this as not really acceptable in a language where I have explicitly declared the variable type, and I would have used OPTION _EXPLICIT also to make sure all my variables were correctly type declared to then have to use type suffixes too.
Code: (Select All)' 64 Bit endian swap, should print DEADBEEFCAFEF00D
' But instead prints... FEFFFEEFCAFEF00D
Dim Shared As _Integer64 rax, rdx
rdx = &H0DF0FECAEFBEADDE&&
Print Hex$(rdx)
Print Hex$(SwapEnd(rdx))
Print Hex$(SwapEnd(SwapEnd(rdx)))
Print "(leading 0 is missing when printed)"
Function SwapEnd~&& (num As _Unsigned _Integer64)
Dim As _Unsigned _Integer64 temp, temp2
temp = _ShL(num And &HFF&&, 56) 'byte #1
temp = temp Or _ShL(num And &HFF00&&, 40) '2
temp = temp Or _ShL(num And &HFF0000&&, 24) '3
temp = temp Or _ShL(num And &HFF000000&&, 8) '4
temp = temp Or _ShR(num And &HFF00000000&&, 8) '5
temp = temp Or _ShR(num And &HFF0000000000&&, 24) '6
temp = temp Or _ShR(num And &HFF000000000000&&, 40) '7
temp = temp Or _ShR(num And &HFF00000000000000&&, 56) '8
SwapEnd = temp
End Function
Too many unnecessary temporary variables also mixing unsigned and signed, although my code above uses 2, I only did that for clarity/sanity. My original code was a function that worked on the reference and passed that back. Is this a quirk/niggle of QB64pe that will stay?

