Mercurial > emacs
comparison src/alloc.c @ 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 | d649f2179d67 |
children | def7b9c64935 |
comparison
equal
deleted
inserted
replaced
1935:047e196658fa | 1936:82bbf90208d4 |
---|---|
989 Lisp_Object | 989 Lisp_Object |
990 make_pure_float (num) | 990 make_pure_float (num) |
991 double num; | 991 double num; |
992 { | 992 { |
993 register Lisp_Object new; | 993 register Lisp_Object new; |
994 int alignment; | |
994 | 995 |
995 /* Make sure that pureptr is aligned on at least a sizeof (double) | 996 /* Make sure that pureptr is aligned on at least a sizeof (double) |
996 boundary. Some architectures (like the sparc) require this, and | 997 boundary. Some architectures (like the sparc) require this, and |
997 I suspect that floats are rare enough that it's no tragedy for | 998 I suspect that floats are rare enough that it's no tragedy for |
998 those that do. */ | 999 those that do. */ |
999 pureptr = (pureptr + sizeof (num) - 1) & - sizeof (num); | 1000 #ifdef __GNUC__ |
1001 #if __GNUC__ >= 2 | |
1002 alignment = __alignof (struct Lisp_Float); | |
1003 #else | |
1004 alignment = sizeof (struct Lisp_Float); | |
1005 #endif | |
1006 #else | |
1007 alignment = sizeof (struct Lisp_Float); | |
1008 #endif | |
1009 pureptr = (pureptr + alignment - 1) & - alignment; | |
1000 | 1010 |
1001 if (pureptr + sizeof (struct Lisp_Float) > PURESIZE) | 1011 if (pureptr + sizeof (struct Lisp_Float) > PURESIZE) |
1002 error ("Pure Lisp storage exhausted"); | 1012 error ("Pure Lisp storage exhausted"); |
1003 XSET (new, Lisp_Float, PUREBEG + pureptr); | 1013 XSET (new, Lisp_Float, PUREBEG + pureptr); |
1004 pureptr += sizeof (struct Lisp_Float); | 1014 pureptr += sizeof (struct Lisp_Float); |