summaryrefslogtreecommitdiff
path: root/ext/dl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-09 16:29:08 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-09 16:29:08 +0000
commit196151158fa777dc88fa54825250898ff1ab5410 (patch)
tree46cbd1fc1829bc7b1188d5d54ae26ff084665134 /ext/dl
parent5ee0135a2f32ea4bb8be5a4cd0a9541f9789f155 (diff)
* 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
Diffstat (limited to 'ext/dl')
-rw-r--r--ext/dl/dl.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/ext/dl/dl.h b/ext/dl/dl.h
index 90e2131..d0a461f 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