about summary refs log tree commit diff stats
path: root/subx/000organization.cc
diff options
context:
space:
mode:
Diffstat (limited to 'subx/000organization.cc')
-rw-r--r--subx/000organization.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/subx/000organization.cc b/subx/000organization.cc
index 320c0d4b..f729b17e 100644
--- a/subx/000organization.cc
+++ b/subx/000organization.cc
@@ -115,6 +115,7 @@ int main(int argc, char* argv[]) {
   // run on a 32-bit system
   assert(sizeof(int) == 4);
   assert(sizeof(float) == 4);
+  assert_little_endian();
 
   // End One-time Setup
 
@@ -138,3 +139,12 @@ int main(int argc, char* argv[]) {
 void reset() {
   // End Reset
 }
+
+void assert_little_endian() {
+  const int x = 1;
+  const char* y = reinterpret_cast<const char*>(&x);
+  if (*y != 1) {
+    cerr << "the SubX VM only runs on little-endian processors. Do you have Intel (or AMD or Atom) inside?\n";
+    exit(1);
+  }
+}
a id='n125' href='#n125'>125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167