ExternalBytes.st
changeset 18582 51ee4f8fa9f2
parent 18580 5bdec8c6f5f2
child 18583 6a555df5d859
--- a/ExternalBytes.st	Wed Jul 15 16:40:19 2015 +0200
+++ b/ExternalBytes.st	Wed Jul 15 16:56:42 2015 +0200
@@ -580,6 +580,36 @@
     "
 !
 
+longAlignment
+    "return the alignement of longs in structs and unions"
+
+%{  /* NOCONTEXT */
+    struct {
+        char c;
+        long l;
+    } dummy;
+    RETURN (__mkSmallInteger( (void*)&dummy.l - (void *)&dummy.c ));
+%}
+    "
+     ExternalBytes longAlignment
+    "
+!
+
+doubleAlignment
+    "return the alignement of longs in structs and unions"
+
+%{  /* NOCONTEXT */
+    struct {
+        char c;
+        double d;
+    } dummy;
+    RETURN (__mkSmallInteger( (char *)&dummy.d - (char *)&dummy.c ));
+%}
+    "
+     ExternalBytes doubleAlignment
+    "
+!
+
 isBuiltInClass
     "return true if this class is known by the run-time-system.
      Here, true is returned."
@@ -597,7 +627,7 @@
         char c;
         long l;
     } dummy;
-    RETURN (__mkSmallInteger( (void*)&dummy.l - (void *)&dummy.c ));
+    RETURN (__mkSmallInteger( (char *)&dummy.l - (char *)&dummy.c ));
 %}
     "
      ExternalBytes longAlignment