/* put a big endian word (32bits) to a pointer 
Caller should ensure parameters are valid. */
void BytesPutBe32(void *ptr, uint32_t v)
/* put a big endian word (32bits) to a pointer 
Caller should ensure parameters are valid. */
void BytesPutBe32(void *ptr, uint32_t v)
{
    uint8_t *p = (uint8_t *)ptr;
    p[0] = (v >> 24) & 0xff;
    p[1] = (v >> 16) & 0xff;
    p[2] = (v >> 8) & 0xff;
    p[3] = v & 0xff;
}