summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2010-02-01 14:13:44 +0000
committerluigi <luigi@FreeBSD.org>2010-02-01 14:13:44 +0000
commitd774a108f2b8f0d231be8b8813c9e69089e2f86c (patch)
tree845fb479e9e7705d68a27b9614c5d456f1a3c301
parent99e94b99379262b699fde4476f0298841a7b92de (diff)
downloadFreeBSD-src-d774a108f2b8f0d231be8b8813c9e69089e2f86c.zip
FreeBSD-src-d774a108f2b8f0d231be8b8813c9e69089e2f86c.tar.gz
use u_char instead of u_int for short bitfields.
For our compiler the two constructs are completely equivalent, but some compilers (including MSC and tcc) use the base type for alignment, which in the cases touched here result in aligning the bitfields to 32 bit instead of the 8 bit that is meant here. Note that almost all other headers where small bitfields are used have u_int8_t instead of u_int. MFC after: 3 days
-rw-r--r--sys/netinet/ip.h8
-rw-r--r--sys/netinet/tcp.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/netinet/ip.h b/sys/netinet/ip.h
index daee533..4fab5cd 100644
--- a/sys/netinet/ip.h
+++ b/sys/netinet/ip.h
@@ -48,11 +48,11 @@
*/
struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN
- u_int ip_hl:4, /* header length */
+ u_char ip_hl:4, /* header length */
ip_v:4; /* version */
#endif
#if BYTE_ORDER == BIG_ENDIAN
- u_int ip_v:4, /* version */
+ u_char ip_v:4, /* version */
ip_hl:4; /* header length */
#endif
u_char ip_tos; /* type of service */
@@ -142,11 +142,11 @@ struct ip_timestamp {
u_char ipt_len; /* size of structure (variable) */
u_char ipt_ptr; /* index of current entry */
#if BYTE_ORDER == LITTLE_ENDIAN
- u_int ipt_flg:4, /* flags, see below */
+ u_char ipt_flg:4, /* flags, see below */
ipt_oflw:4; /* overflow counter */
#endif
#if BYTE_ORDER == BIG_ENDIAN
- u_int ipt_oflw:4, /* overflow counter */
+ u_char ipt_oflw:4, /* overflow counter */
ipt_flg:4; /* flags, see below */
#endif
union ipt_timestamp {
diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h
index 8779582..2929d0d 100644
--- a/sys/netinet/tcp.h
+++ b/sys/netinet/tcp.h
@@ -52,11 +52,11 @@ struct tcphdr {
tcp_seq th_seq; /* sequence number */
tcp_seq th_ack; /* acknowledgement number */
#if BYTE_ORDER == LITTLE_ENDIAN
- u_int th_x2:4, /* (unused) */
+ u_char th_x2:4, /* (unused) */
th_off:4; /* data offset */
#endif
#if BYTE_ORDER == BIG_ENDIAN
- u_int th_off:4, /* data offset */
+ u_char th_off:4, /* data offset */
th_x2:4; /* (unused) */
#endif
u_char th_flags;
OpenPOWER on IntegriCloud