Is there anyway i can create my own data type based on an Integer, basicly I want to change the way the bits are stored.

eg)

00000000 00000000 00000001 00001111

Normally this would represent 2^0+2^1+2^2+2^3+2^8 = 135

I want the DataType to Interpert that as this:

00000000 00011111 2^0+2^1+2^2+2^3+2^4 = 31

I dont really need help with the math, I have implemented this as a class i *think* it would be easier to use if a implemented as a data type.

Any examples on how to define your own data type?