Thread (4 messages) flat view 4 messages, 3 authors, 2002-08-08
STALE8803d

[PATCH] fix HIPQUAD macro in kernel.h

From: Harald Welte <laforge@gnumonks.org>
Date: 2002-08-08 11:27:44
Also in: lkml

Hi Dave!

Below is a fix for the HIPQUAD macro in kernel.h.  The macro is currently
not endian-aware - it just assumes running on a little-endian machine.

If you don't like the #ifdefs in kernel.h, the macros could be moved into 
include/linux/byteorder/.

Please apply, thanks
--- linux-2.4.19-rc5-plain/include/linux/kernel.h	Wed Aug  7 22:55:03 2002
+++ linux-2.4.19-rc5-endian/include/linux/kernel.h	Thu Aug  8 11:34:13 2002
@@ -12,6 +12,7 @@
 #include <linux/stddef.h>
 #include <linux/types.h>
 #include <linux/compiler.h>
+#include <asm/byteorder.h>
 
 /* Optimization barrier */
 /* The "volatile" is due to gcc bugs */
@@ -128,11 +129,17 @@
 	((unsigned char *)&addr)[2], \
 	((unsigned char *)&addr)[3]
 
+#if defined(__LITTLE_ENDIAN)
 #define HIPQUAD(addr) \
 	((unsigned char *)&addr)[3], \
 	((unsigned char *)&addr)[2], \
 	((unsigned char *)&addr)[1], \
 	((unsigned char *)&addr)[0]
+#elif defined(__BIG_ENDIAN)
+#define HIPQUAD	NIPQUAD
+#else
+#error "Please fix asm/byteorder.h"
+#endif /* __LITTLE_ENDIAN */
 
 /*
  * min()/max() macros that also do
-- 
Live long and prosper
- Harald Welte / laforge@gnumonks.org               http://www.gnumonks.org/
============================================================================
GCS/E/IT d- s-: a-- C+++ UL++++$ P+++ L++++$ E--- W- N++ o? K- w--- O- M+ 
V-- PS++ PE-- Y++ PGP++ t+ 5-- !X !R tv-- b+++ !DI !D G+ e* h--- r++ y+(*)

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help