See the definition of TCP header in /netinet/tcp.h:
struct tcphdr { u_int16_t th_sport; /* source port */ u_int16_t th_dport; /* destin
This is compiler-dependent and non-portable. How bit fields are ordered is implementation dependent, it would be far better here to use an 8-bit field and shift/mask to obtain the subfields.