C#: Convert Integer to unsigned 24-bit Integer
by admin on Aug.04, 2011, under Programming
The following C-Sharp sample code will convert a regular 32-bit Integer to an unsigned 24-bit Integer:
byte[] b = BitConverter.GetBytes(i); uint ret = (((uint)b[0]) << 16) | (((uint)b[1])<<8) | ((uint)b[2]);