You can use a struct, it's not elegant but sounds like what you're looking for. Note that you must define the struct alignment to 1 byte. You're also limited to 64bit.
typedef struct Int24 {
int value : 24;
} Int;
typedef struct UInt24 {
unsigned value : 24;
} UInt24;
typedef struct Int48 {
long long value : 48;
} Int48;
With templates:
template<int bytes> struct Int {
long long value : bytes * 8;
};
typedef Int<1> Int8;
typedef Int<6> Int48;
With macro:
#define DECL_INT(n) \
typedef struct _Int##n { \
long long value : n; \
} Int##n
// declaration of type
DECL_INT(48); // produces Int48
// usage
Int48 i48;