summaryrefslogtreecommitdiff
path: root/sys/arch/m68k/include/endian.h
diff options
context:
space:
mode:
authorgrr <grr@cvs.openbsd.org>1997-06-25 12:52:12 +0000
committergrr <grr@cvs.openbsd.org>1997-06-25 12:52:12 +0000
commit47dc7a62ced6f83086840c994b7fd839a808721b (patch)
tree6e5e2bcdb6560d3a9bb57cda0a3611226fcb535d /sys/arch/m68k/include/endian.h
parent9f5b8216c2af91286d9d2beb109f93ce776885ca (diff)
Include usage notes in the rest of the endian.h files for consistancy.
Diffstat (limited to 'sys/arch/m68k/include/endian.h')
-rw-r--r--sys/arch/m68k/include/endian.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/arch/m68k/include/endian.h b/sys/arch/m68k/include/endian.h
index 02875635f86..b9514134c68 100644
--- a/sys/arch/m68k/include/endian.h
+++ b/sys/arch/m68k/include/endian.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: endian.h,v 1.7 1997/06/25 12:32:50 downsj Exp $ */
+/* $OpenBSD: endian.h,v 1.8 1997/06/25 12:52:09 grr Exp $ */
/* $NetBSD: endian.h,v 1.10 1996/10/13 02:59:55 christos Exp $ */
/*
@@ -139,6 +139,13 @@ __END_DECLS
/*
* Macros for network/external number representation conversion.
+ *
+ * The way this works is that HTONS(x) modifies x and *can't* be used as
+ * and rvalue i.e. foo=HTONS(bar) is wrong. Likewise x=htons(x) should
+ * never be used where HTONS(x) will serve i.e. foo=htons(foo) is wrong.
+ * Failing to observe these rule will result in code that appears to work
+ * and probably does work, but generates gcc warnings on architectures
+ * where the macros are used to optimize away an unneeded conversion.
*/
#define ntohl(x) betoh32(x)
#define ntohs(x) betoh16(x)