Unions of the same size and pointers
So I have two union typedefs:
Code:
typedef union LOWFIXED20_12
{
int full;
struct lowPart20_12
{
int fraction: 12,
integer: 4;
};
};
typedef union MIDFIXED20_12
{
int full;
struct midPart20_12
{
int fraction: 8,
integer: 8;
};
};
And I have 4 arrays, 2 of each type. I also have a pointer to each array. I have a function that "swaps" the arrays by simply just exchanging the pointers.
Considering that both of these unions are of the same size, int, I was wondering if there was a way to write one function that would take a pointer of either type . . . or do I have to write two separate functions because these are technically of different types?
I know the function is small and fast, but I guess it was more of general question than something that is important to what I am doing.
Thanks