I have a project that I am working on where I require a data type that doesn’t exist in the .NET BCL – an Unsigned Int24. For calculations that I am doing, the 4th byte in an int32, even when set to all zeroes, screws up my results.
EDIT:
I’m doing bitwise circular shifts on a 24bit integer space that is limited to only 24bits. If the rotation is performed at 24bit level on a 32bit number the result is wildly incorrect.
Does anyone know of any third party implementations of this data type that are available?
Thanks!
Implementing Int24 isn’t hard (honest!). But we need to know more about why you need to implement it. @nneonneo wonders if you’re trying to interface with a native library that uses 24-bit integers. If that’s the case then you can be done by doing something like this:
Modifying the class for big-endian or signed Int24 is an exercise left up to the reader.