Code: Select all
union
{
u_int<1024> MyBigNumber;
struct
{
u_int<512> TopHalfOfBigNumber;
union
{
u_int<512> BottomHalfOfBigNumber;
struct
{
u_int<256> TopHalfofBottomHalf;
u_int<256> BottomHalfofBottomHalf;
};
}
};
};
I'm working with unsigned ints, signed ints, and floats and need addition, subtraction, division, and multiplication. I'm thinking of writing my own template class to do this, but I would like some one to point me in the right direction.
An alternative way would be a class which points to an area of memory. E.g.
Code: Select all
Integer myInt(0x12345 /* address of integer */, 1024 /* how big the integer is */);