How can I check if the address value in a long variable is 32bit or 64bit
Example:
long a = 0x06000000
long b = 0x13FFF0000
How can I programmatically check the bitness of these addresses?
CodePudding user response:
You can use an AND operation to check if any of the higher 32 bits are set. Assuming that you have ulong
because addresses are not negative:
if ((x & 0xFFFFFFFF00000000UL) == 0)
Console.WriteLine("x would fit into 32 bit");