move htonl() + friends to util.h
authorGerd Hoffmann <kraxel@redhat.com>
Fri, 18 Dec 2009 11:16:03 +0000 (12:16 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 18 Dec 2009 15:37:57 +0000 (09:37 -0600)
As the next patch will add one more user of the macros move them
to util.h.  Also add the 16bit variants.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
src/coreboot.c
src/util.h

index 7fa18e4da0698b6806a11997e970de5efc50522e..3dc6a7fd775a8505f7aefef58ccfbc20e4b9785c 100644 (file)
@@ -351,11 +351,6 @@ ulzma(u8 *dst, u32 maxlen, const u8 *src, u32 srclen)
  * Coreboot flash format
  ****************************************************************/
 
-// XXX - optimize
-#define ntohl(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | \
-                  (((x)&0xff0000) >> 8) | (((x)&0xff000000) >> 24))
-#define htonl(x) ntohl(x)
-
 #define CBFS_HEADER_MAGIC 0x4F524243
 #define CBFS_HEADPTR_ADDR 0xFFFFFFFc
 #define CBFS_VERSION1 0x31313131
index 1eafce0593b2d3accd6539157b2f6ab34a37c73d..24e39d1b47ba2391fa91c79e0fac3fefc957484a 100644 (file)
@@ -367,4 +367,11 @@ extern u8 BiosChecksum;
 // version (auto generated file out/version.c)
 extern const char VERSION[];
 
+// XXX - optimize
+#define ntohl(x) ((((x)&0xff)<<24) | (((x)&0xff00)<<8) | \
+                  (((x)&0xff0000) >> 8) | (((x)&0xff000000) >> 24))
+#define htonl(x) ntohl(x)
+#define ntohs(x) ((((x)&0xff)<<8) | (((x)&0xff00)>>8))
+#define htons(x) ntohs(x)
+
 #endif // util.h