#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Sun, 17 Mar 2019 12:57:59 +0100
changeset 23931 e56b90ae68bd
parent 23930 4a6dd956e708
child 23932 01800d8961bd
#FEATURE by cg class: ExternalBytes class added: #nativeByteOrder
ExternalBytes.st
--- a/ExternalBytes.st	Sun Mar 17 12:22:14 2019 +0100
+++ b/ExternalBytes.st	Sun Mar 17 12:57:59 2019 +0100
@@ -690,6 +690,28 @@
     "
 !
 
+nativeByteOrder
+    "returns the underlying CPU's native byte order as
+     a symbol; either #msb or #lsb"
+
+%{ /* NOCONTEXT */
+#ifndef __SCHTEAM__
+# ifdef __LSBFIRST__
+    RETURN ( @symbol(lsb) );
+# else
+    RETURN ( @symbol(msb) );
+# endif
+#endif
+%}.
+    self primitiveFailed.
+
+    "
+     ExternalBytes nativeByteOrder
+    "
+
+    "Created: / 17-03-2019 / 12:57:28 / Claus Gittinger"
+!
+
 pointerAlignment
     "return the alignement of pointers in structs and unions"