Thanks everybody for your helpful replies. At the moment I'm using the
following:
uint16_t Get16(uint8_t const *const p)
{
return ((uint16_t)(p[0]) << 8) | p[1];
}
void Set16(uint8_t *const p,uint16_t const val)
{
p[0] = val >8;
p[1] = val & 0xFF;
}
uint32_t Get32(uint8_t const *const p)
{
return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) |
((uint32_t)(p[2]) << 8) | p[3];
}
void Set32(uint8_t *const p,uint32_t const val)
{
p[0] = val >24;
p[1] = val >16;
p[2] = val >8;
p[3] = val;
}