On Friday 06 February 2009 16:22:01 Peter Tyser wrote:
> Add a mkimage_win32.exe build target which can produce a native
> win32 mkimage executable using the MinGW toolchain.  The
> mkimage_win32.exe binary is generated when the MINGW_COMPILE
> environment variable is defined.  The mkimage_win32.exe binary
> can be used by those who use Windows as an OS build environment
> but don't use cygwin.

having to set magic env vars for one specific target kind of sucks.  isnt 
there another way to do this ?

> +uint16_t bswap_16(uint16_t __x)
> +{
> +     return (__x >> 8) | (__x << 8);
> +}
> +
> +uint32_t bswap_32(uint32_t __x)
> +{
> +     return (bswap_16(__x & 0xffff) << 16) | (bswap_16(__x >> 16));
> +}
> +
> +uint64_t bswap_64(uint64_t __x)
> +{
> +     return (((uint64_t) bswap_32(__x & 0xffffffff)) << 32) |
> +             (bswap_32(__x >> 32));
> +}

we already have random duplicate copies of these floating around, and not 
related to Windows.  these funcs are really only reliable on Linux.  like the 
attached i'm using in my own tree.
-mike
From 9f9c2cf0642111757cb608fcc06efe2da3b80558 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
Date: Tue, 13 Jan 2009 11:03:39 -0500
Subject: [PATCH] uswap.h: unify byte swap functions for U-Boot

Signed-off-by: Mike Frysinger <[email protected]>
---
 include/uswap.h       |   29 ++++++++++

diff --git a/include/uswap.h b/include/uswap.h
new file mode 100644
index 0000000..f8a0313
--- /dev/null
+++ b/include/uswap.h
@@ -0,0 +1,29 @@
+#ifndef __UBOOT_SWAP__
+#define __UBOOT_SWAP__
+
+#define uswap_16(x) \
+	((((x) & 0xff00) >> 8) | \
+	 (((x) & 0x00ff) << 8))
+
+#define uswap_32(x) \
+	((((x) & 0xff000000) >> 24) | \
+	 (((x) & 0x00ff0000) >>  8) | \
+	 (((x) & 0x0000ff00) <<  8) | \
+	 (((x) & 0x000000ff) << 24))
+
+#define _uswap_64(x, sfx) \
+	((((x) & 0xff00000000000000##sfx) >> 56) | \
+	 (((x) & 0x00ff000000000000##sfx) >> 40) | \
+	 (((x) & 0x0000ff0000000000##sfx) >> 24) | \
+	 (((x) & 0x000000ff00000000##sfx) >>  8) | \
+	 (((x) & 0x00000000ff000000##sfx) <<  8) | \
+	 (((x) & 0x0000000000ff0000##sfx) << 24) | \
+	 (((x) & 0x000000000000ff00##sfx) << 40) | \
+	 (((x) & 0x00000000000000ff##sfx) << 56))
+#if defined(__GNUC__)
+# define uswap_64(x) _uswap_64(x, ull)
+#else
+# define uswap_64(x) _uswap_64(x, )
+#endif
+
+#endif
-- 
1.6.1.2

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to