pkgsrc/devel/cqual/patches/patch-bl

30 lines
781 B
Text

$NetBSD: patch-bl,v 1.1 2006/01/18 23:24:12 rillig Exp $
SunPro does not know __alignof__. Replaced it with the size of ''x'',
rounded up to the next power of two.
--- src/types.c.orig 2003-12-12 17:09:49.000000000 +0100
+++ src/types.c 2006-01-16 14:27:49.278596800 +0100
@@ -23,6 +23,22 @@ Boston, MA 02111-1307, USA. */
#include <stddef.h>
#include "user-qual.h"
+#if !defined(__GNUC__)
+
+/* http://www.hackersdelight.org/HDcode.htm, figure 3.3 */
+static inline size_t clp2(size_t x) {
+ x = x - 1;
+ x = x | (x >> 1);
+ x = x | (x >> 2);
+ x = x | (x >> 4);
+ x = x | (x >> 8);
+ x = x | (x >>16);
+ return x + 1;
+}
+
+# define __alignof__(x) (clp2(sizeof(x)))
+#endif
+
struct type
{
enum { tk_primitive, tk_complex, tk_tagged, tk_error, tk_void,