Uses UDblToLong/LongToUDbl functions from here:
http://www.codenewsgroups.net/...cussion/topic7027.aspx
I store the two unsigned 32-bit longs in doubles, reconvert them to long, and then XOR these together, and store the returned unsigned 32-bit value in a double again so it is represented properly. No compiler options or API needed but I can't guarantee proper results. Briefly checking with calc, it seems to be correct.
Also check out UnsignedAdd/UnsignedSubtract (google). I haven't really messed with these though. I don't even know if you need to use these, you can probably just use something similar to what I did for UnsignedXOR as long as the answer is 64-bit or smaller.
Sorry for bad paste, see URL here or below:
http://rafb.net/p/Ygxxpq83.html
----------------------------
Option Explicit
Private Const U32_CVT = 4294967296#
Private Sub Form_Load()
Dim x As Double, y As Double, z As Double
x = 4075048959#
y = 4175048959#
z = UnsignedXor(x, y)
MsgBox CStr(z)
End Sub
Public Function UnsignedXor(uint0 As Double, uint1 As Double) As Double
UnsignedXor = LongToUDbl(UDblToLong(uint0) Xor UDblToLong(uint1))
End Function
Public Function UDblToLong(Udbl As Double) As Long
'Returns vb Long value compatible with 'C' 32-bit unsigned
'DWORD, ULONG types for vb Double in range 0 to 4,294,967,295.
Select Case Udbl
Case 0# To 2147483647#
UDblToLong = CLng(Udbl) 'Ok - return input
Case 2147483648# To 4294967295# 'convert to Long in range
'-2,147,483,648 to -1
UDblToLong = CLng(Udbl - U32_CVT)
Case Else 'won't work - force error if input <0 or >4294967295
Err.Raise 6, , "UDblToLong overflow" & vbCrLf & "Value is out of range for DWORD, ULONG type"
End Select
End Function
Public Function LongToUDbl(Lnum As Long) As Double
'Returns positive vb Double value for 'C' DWORD, ULONG
'unsigned 32-bit types stored in vb Long.
If Lnum < 0& Then 'convert to positive Double in range
'2,147,483,648 to 4,294,967,295.
LongToUDbl = U32_CVT + CDbl(Lnum)
Else
LongToUDbl = CDbl(Lnum) 'Ok - return input
End If
End Function