diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ext/dl/dl.h | 5 |
2 files changed, 6 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Fri Feb 10 01:29:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ext/dl/dl.h (DLALIGN): round up at once and get rid of overflow. + Fri Feb 10 00:47:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> * test/ruby/envutil.rb (assert_no_memory_leak): new assertion to 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 |