i have some low level image/texture operations where 32-bit colors are stored as UInt32 or int and i need a really fast bitwise conversion between the two.
e.g.
int color = -2451337;
//exception
UInt32 cu = (UInt32)color;
any ideas?
thanks and regards
int color = -2451337;
unchecked {
uint color2 = (uint)color;
// color2 = 4292515959
}
BitConverter.ToUInt32(BitConverter.GetBytes(-2451337), 0)
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