03-22-2025, 04:01 PM
See my post above yours. I believe you missed it as I posted the second post and you were probably typing your response.
Basically it's an issue that goes back to QB45 days and us maintaining backwards compatibility for that old code. You just need to add the proper suffix to your &H values to make certain that they're the return value you expect and not something unexpected.
And I'm not certain what you're talking about with temp variables mixing signed and unsigned? You can strip those out completely.
Basically it's an issue that goes back to QB45 days and us maintaining backwards compatibility for that old code. You just need to add the proper suffix to your &H values to make certain that they're the return value you expect and not something unexpected.
And I'm not certain what you're talking about with temp variables mixing signed and unsigned? You can strip those out completely.
Code: (Select All)
Dim As _Integer64 rdx
rdx = &H0DF0FECAEFBEADDE
Print Hex$(rdx)
Print Hex$(SwapEnd(rdx))
Print Hex$(SwapEnd(SwapEnd(rdx)))
Print
Print "(leading 0 is missing when printed)"
Function SwapEnd~&& (num As _Unsigned _Integer64)
SwapEnd = _ShL(num And &HFF&&, 56) OR _
_ShL(num And &HFF00&&, 40) OR _
_ShL(num And &HFF0000&&, 24) OR _
_ShL(num And &HFF000000&&, 8) OR _
_ShR(num And &HFF00000000&&, 8) OR _
_ShR(num And &HFF0000000000&&, 24) OR _
_ShR(num And &HFF000000000000&&, 40) OR _
_ShR(num And &HFF00000000000000&&, 56)
End Function