summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authorngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-21 17:34:58 +0000
committerngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-21 17:34:58 +0000
commit971769cd7632cd13be53c9c2e777b7f6810bfd4b (patch)
tree66f3a154e3e15244f8807c27fd409fdaec014456 /numeric.c
parentcb2a69d883469d8929892facb6c48059bdfac3dd (diff)
* numeric.c (rb_infinity, rb_nan): use union to prevent bus error
caused by misalignment. [Bug #5469] [ruby-dev:44657] * include/ruby/missing.h (INFINITY, NAN): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/numeric.c b/numeric.c
index 6d3c1432e8..17ddb84459 100644
--- a/numeric.c
+++ b/numeric.c
@@ -66,16 +66,16 @@
#ifdef HAVE_INFINITY
#elif !defined(WORDS_BIGENDIAN) /* BYTE_ORDER == LITTLE_ENDIAN */
-const unsigned char rb_infinity[] = "\x00\x00\x80\x7f";
+const union bytesequence4_or_float rb_infinity = { 0x00, 0x00, 0x80, 0x7f };
#else
-const unsigned char rb_infinity[] = "\x7f\x80\x00\x00";
+const union bytesequence4_or_float rb_infinity = { 0x7f, 0x80, 0x00, 0x00 };
#endif
#ifdef HAVE_NAN
#elif !defined(WORDS_BIGENDIAN) /* BYTE_ORDER == LITTLE_ENDIAN */
-const unsigned char rb_nan[] = "\x00\x00\xc0\x7f";
+const union bytesequence4_or_float rb_nan = { 0x00, 0x00, 0xc0, 0x7f };
#else
-const unsigned char rb_nan[] = "\x7f\xc0\x00\x00";
+const union bytesequence4_or_float rb_nan = { 0x7f, 0xc0, 0x00, 0x00 };
#endif
#ifndef HAVE_ROUND