When I try to create the following variable:
UInt64 mod32 = (UInt64)(UInt32.MaxValue + 1);
and I get the following Error: 'The operation overflows at compile time in checked mode
'
How can I fix/ignore this?
When I try to create the following variable:
UInt64 mod32 = (UInt64)(UInt32.MaxValue + 1);
and I get the following Error: 'The operation overflows at compile time in checked mode
'
How can I fix/ignore this?
You should do as below:
UInt64 mod32 = UInt32.MaxValue + (UInt64)1;
When you do (UInt64)(UInt32.MaxValue + 1)
the program will try to do UInt32.MaxValue + 1
first, which is the reason for the error, and then cast to UInt64
.