junkcode: new addition.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 2 Sep 2010 10:11:40 +0000 (19:41 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 2 Sep 2010 10:11:40 +0000 (19:41 +0930)
junkcode/mansourmoufid@gmail.com-endianness/endianness.c [new file with mode: 0644]

diff --git a/junkcode/mansourmoufid@gmail.com-endianness/endianness.c b/junkcode/mansourmoufid@gmail.com-endianness/endianness.c
new file mode 100644 (file)
index 0000000..f01b94f
--- /dev/null
@@ -0,0 +1,10 @@
+#include <stdint.h>
+/* returns 0 for little-endian, 1 for big-endian */
+int main( void )
+{
+  static const uint64_t one = (uint64_t) 1;
+  if ((uint8_t) 1 == *((uint8_t *) &one))
+    return 0;
+  else
+    return 1;
+}