I am trying to assign an int to an hex number. const int a = 0xFFFFFFF0; I got an error: Cannot implicitly convert type 'uint'. An explicit conversion exsist (are you missing a cast?) Does someone know how to fix it? tnx
const int a = unchecked((int)0xFFFFFFF0);
or simpler:
const int a = -16;
use
const uint a = 0xFFFFFFF0
;-)
Background: 0xFFFFFFF0
is too big to fit into an int
, which goes from − 2,147,483,648 to 2,147,483,647, where as uint
goes from 0 to 4,294,967,295, which is just above 0xFFFFFFF0
(= 4,294,967,280).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With