Somewhere around Day 25 of HMH Casey was using win32-defined union called LARGE_INTEGER (https://msdn.microsoft.com/en-us/...esktop/aa383713%28v=vs.85%29.aspx) to pass a 64bit integer as a pair of two 32bit integers to some win32 API like this:
1 2 3 4 | uint64 sourceValue = 0x123456789ABCDEFF; LARGE_INTEGER transformer; transformer.QuadPart = sourceValue; someWin32Api(transformer.LowPart, transformer.HighPart); |
I don't understand why it works. If I understand endiannes concept correctly (I am not sure) it actually depends on machine endiannes what exact values LowPart and HighPart would have. Could someone please explain this?
Before this Casey was doing the very same thing like this (which makes much more sense to me):
1 2 3 4 | uint64 sourceValue = 0x123456789ABCDEFF; uint32 lowPart = (uint32)(sourceValue & 0xFFFFFFFF); uint32 highPart = (uint32)(sourceValue >> 32); someWin32Api(lowPart, highPart); |
Are this two peaces of code identical if we take endiannes into account?
(I understand that virtually all hardware uses Little Endian this days, I just want to better understand the concept).