summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog4
-rw-r--r--ext/dl/dl.h5
2 files changed, 6 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 57feff07e5..3c706b5db8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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