From 196151158fa777dc88fa54825250898ff1ab5410 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 9 Feb 2012 16:29:08 +0000 Subject: * ext/dl/dl.h (DLALIGN): round up at once and get rid of overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/dl/dl.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'ext') diff --git a/ext/dl/dl.h b/ext/dl/dl.h index 90e2131ee2..d0a461f921 100644 --- a/ext/dl/dl.h +++ b/ext/dl/dl.h @@ -155,9 +155,8 @@ typedef struct { char c; LONG_LONG x; } s_long_long; #define ALIGN_FLOAT (sizeof(s_float) - sizeof(float)) #define ALIGN_DOUBLE (sizeof(s_double) - sizeof(double)) -#define DLALIGN(ptr,offset,align) {\ - while( (((unsigned long)((char *)(ptr) + (offset))) % (align)) != 0 ) (offset)++;\ -} +#define DLALIGN(ptr,offset,align) \ + ((offset) += ((align) - ((uintptr_t)((char *)(ptr) + (offset))) % (align)) % (align)) #define DLTYPE_VOID 0 -- cgit v1.2.3