summaryrefslogtreecommitdiffstats
path: root/Modules/TestBigEndian.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/TestBigEndian.c')
-rw-r--r--Modules/TestBigEndian.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/TestBigEndian.c b/Modules/TestBigEndian.c
new file mode 100644
index 0000000..377d1b1
--- /dev/null
+++ b/Modules/TestBigEndian.c
@@ -0,0 +1,10 @@
+int main () {
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long l;
+ char c[sizeof (long)];
+ } u;
+ u.l = 1;
+ exit (u.c[sizeof (long) - 1] == 1);
+}