changeset 1936:82bbf90208d4

* alloc.c (make_pure_float): Align pureptr according to __alignof, if it's available, or sizeof (struct Lisp_Float) if it's not.
author Jim Blandy <jimb@redhat.com>
date Mon, 22 Feb 1993 16:21:17 +0000
parents 047e196658fa
children 087889e85644
files src/alloc.c
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/alloc.c	Mon Feb 22 15:10:46 1993 +0000
+++ b/src/alloc.c	Mon Feb 22 16:21:17 1993 +0000
@@ -991,12 +991,22 @@
      double num;
 {
   register Lisp_Object new;
+  int alignment;
 
   /* Make sure that pureptr is aligned on at least a sizeof (double)
      boundary.  Some architectures (like the sparc) require this, and
      I suspect that floats are rare enough that it's no tragedy for
      those that do.  */
-  pureptr = (pureptr + sizeof (num) - 1) & - sizeof (num);
+#ifdef __GNUC__
+#if __GNUC__ >= 2
+  alignment = __alignof (struct Lisp_Float);
+#else
+  alignment = sizeof (struct Lisp_Float);
+#endif
+#else
+  alignment = sizeof (struct Lisp_Float);
+#endif  
+  pureptr = (pureptr + alignment - 1) & - alignment;
 
   if (pureptr + sizeof (struct Lisp_Float) > PURESIZE)
     error ("Pure Lisp storage exhausted");