I'd like to represent an integer with a value between 0-100,000. Unsigned short int (range 0-65535) is too small. Unsigned int (range 0 - 4294967295) is big enough, but for a large data set this wastes a lot of space. Does there already exist a class that is in between?
I've thought of creating my own class:
class MediumInt
{
// Member functions bitwise arithmetic
// Member functions print integer value
char aVal;
int bVal;
};
But, I'm not sure I could write something that was efficient enough. So, A) Does it already exists? B) If not, am I kinda on the right track for writing a class to fill the sweet spot between short int and int?