Fastest way to cast int to UInt32 bitwise?
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 } Jader Dias BitConverter.ToUInt32(BitConverter.GetBytes(-2451337), 0) Those using a language like VB, which don't have a really convenient way of disabling overflow checks during the conversion, could use something like: Shared Function unsToSign64(ByVal val As