What's the recommended way of merging two 8 bit unsigned integers into a single 16 bit unsigned integer?
typedef volatile union
{
uint16_t TCNT;
struct
{
uint8_t TCNTnL;
uint8_t TCNTnH;
};
} TCNT_t;
or
typedef volatile union
{
uint16_t TCNT;
struct
{
uint16_t TCNTnL:8;
uint16_t TCNTnH:8;
};
} TCNT_t;
?
I'm asking, because I've heard it's not recommended to do implicit casting in unions...
- it's in an 8bit environment!