This seems like an old question and I've stumbled that I want to have this capability also.
Because nobody yet mentioned this, if you would have threshold that would validate that the number is below that range ceiling what you can do is store both numbers in one number type by storing their bits separately.
You would store the first number setting the bits as you would in little endian, for the second number you would store the bits in big endian.
Then you can abstract this to working just with bytes as size and the length of a byte depending on your arch, usually 1 byte is 8 bits so that means using lets say uint16 (2 bytes) we can restrict each number to half the space as in each number stored would need to be a uint8.
If we store in a uint8 then both numbers should be represented within 4 bits each.
This would be useful for small numbers because of the obvious restrction..
// Examples
// uint8 - store first number - little endian
[0][0][0][0] [1][1][1][1] = 15 // storing in 4 bits the max value
// uint8 adding value of 3 as second value in big endian
[1][1][0][0] [1][1][1][1]
// uint16 store first number - little endian
[0][0][0][0][0][0][0][0] [1][1][1][1][1][1][1][1] = 255 // storing in 8 bits the max value
so max value is 15 if you store in 4 bits and 255 if you would store in 8 bits, anything stored above that would overflow and corrupt the other stored value.
Obviously treating them as little endian and big endian only works with two numbers when you don't need further partitioning as it helps when thinking about how they are stored. And there might be libraries that automatically help between endianness representation.
But you could partition the bytes in how many slices of bits you want it's just that without using endianness you might need to do more conversion manually.
Partitioning is also in the answer of intotito yet few answers point out that you need a ceiling threshold for your values, else it's just a loaded footgun.