summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-15 04:50:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-15 04:50:49 +0000
commit1a42f3683fbd3735c3d217cc4cf31fdc1af1a93e (patch)
tree0439faedcb90506aaadaae88528008721a33e529
parentb9d29603375d17c3d1d609d9662f50beaec61fa1 (diff)
* bignum.c: Add static assertions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--bignum.c6
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d9545f5ef4..7f0d3c68141 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Jul 15 13:46:26 2013 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c: Add static assertions.
+
Mon Jul 15 13:36:02 2013 Masaki Matsushita <glass.saga@gmail.com>
* hash.c (rb_hash_each_pair): performance improvement by using
diff --git a/bignum.c b/bignum.c
index be52af6b9b4..7c75bcf9049 100644
--- a/bignum.c
+++ b/bignum.c
@@ -45,6 +45,12 @@ static VALUE big_three = Qnil;
#endif
STATIC_ASSERT(sizeof_bdigit_dbl, sizeof(BDIGIT_DBL) == SIZEOF_BDIGIT_DBL);
+STATIC_ASSERT(sizeof_bdigit_dbl_signed, sizeof(BDIGIT_DBL_SIGNED) == SIZEOF_BDIGIT_DBL);
+STATIC_ASSERT(sizeof_bdigit, SIZEOF_BDIGITS <= sizeof(BDIGIT));
+STATIC_ASSERT(sizeof_bdigit_and_dbl, SIZEOF_BDIGITS*2 <= SIZEOF_BDIGIT_DBL);
+STATIC_ASSERT(bdigit_signedness, 0 < (BDIGIT)-1);
+STATIC_ASSERT(bdigit_dbl_signedness, 0 < (BDIGIT_DBL)-1);
+STATIC_ASSERT(bdigit_dbl_signed_signedness, 0 > (BDIGIT_DBL_SIGNED)-1);
STATIC_ASSERT(rbignum_embed_len_max, RBIGNUM_EMBED_LEN_MAX <= (RBIGNUM_EMBED_LEN_MASK >> RBIGNUM_EMBED_LEN_SHIFT));
#ifdef WORDS_BIGENDIAN