Generally speaking, a value of double is not always representable
when demoted to a float. ISO C defines what to do when such
conversion loses precision, but leaves it undefined when the
value is completely out of range. (cf: ISO/IEC 9899:1990 section
6.2.1.4).
Because ruby do not have half-precision floating-point types this
is not a frequent headache but for pack / unpack, there are
specifiers that has something to do with C float types. We have
to explicitly care these situations.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
with the directives "B", "b", "H" and "h".
* pack.c (pack_pack, pack_unpack_internal): infect taint flag.
* test/ruby/test_pack.rb: add test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (UNREACHABLE_RETURN): UNREACHABLE at the end
of non-void functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for
optimization bug of Oracle Developer Studio (Oracle Solaris Studio)
12.4, 12.5, and 12.6 on Solaris 10 with -xO4 optimization option.
[Bug #11684] [ruby-core:84351]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* pack.c (pack_unpack_internal): set ASCII only properly on "M",
may be ASCII only. [ruby-core:83055] [Bug #13949]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* pack.c (pack_unpack, AVOID_CC_BUG): Very ugly workaround for
optimization bug of Oracle Solaris Studio 12.4 and 12.5
(Oracle Developer Studio 12.5) on Solaris with -xO4 optimization
option. [Bug #11684] [ruby-core:80690]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Fix unpacking with 'b', 'B', 'h' and 'H' format. Do not return an
uninitialized String to Ruby before filling the content bytes.
Fixes r11175 ("pack.c (pack_unpack): execute block if given with
unpacked value instead of creating an array", 2006-10-15).
[ruby-core:78841] [Bug #13075]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* pack.c (str_associate): remove unnecessary branch.
the argument must be a plain vanilla string object.
* pack.c (str_associated): use rb_ivar_lookup to give the
undefined value.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c (ruby_only_for_internal_use): raise fatal error when
deprecated function only for internal use is called, not just a
warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* pack.c (pack_pack): always check index range against the
receiver array length, which can be shortened by elements
conversion. reported by Marcin 'Icewall' Noga of Cisco Talos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
optimization bug of Oracle Solaris Studio 12.4 on Solaris
with -xO4 optimization option. [Bug #11684]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
with signed and unsigned integers.
* NEWS: mention bout this featre.
[Feature #11215] [ruby-dev:49015]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c (to_be_skipped_id): ignore anonymous attributes.
* pack.c (Init_pack): use anonymous ID so that associated objects
do not appear in the packed result.
* parse.y (rb_make_internal_id): return an anonymous ID for
internal use.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* pack.c (str_associate, str_associated): keep associated objects
in an instance variables, instead of in the internal structure.
* string.c (rb_str_associate, rb_str_associated): deprecate.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(HOST_BIGENDIAN_P): New macro.
(ALIGNOF): New macro.
(CLEAR_LOWBITS): New macro.
(FILL_LOWBITS): New macro.
(swap_bdigit): New macro.
(bary_2comp): Returns an int.
* internal.h (swap16): Moved from pack.c
(swap32): Ditto.
(swap64): Ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(integer_unpack_num_bdigits): Extracted from
rb_integer_unpack_internal.
(bary_unpack_internal): Renamed from bary_unpack and support
INTEGER_PACK_2COMP.
(bary_unpack): New function to validate arguments and invoke
bary_unpack_internal.
(rb_integer_unpack_internal): Removed.
(rb_integer_unpack): Invoke bary_unpack_internal.
(rb_integer_unpack_2comp): Removed.
* internal.h (rb_integer_unpack_2comp): Removed.
* pack.c: Follow the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(rb_integer_unpack_internal): Extracted from rb_integer_unpack and
nlp_bits_ret argument added.
(integer_unpack_num_bdigits_small): nlp_bits_ret argument added to
return number of leading padding bits.
(integer_unpack_num_bdigits_generic): Ditto.
* internal.h (rb_integer_unpack_2comp): Declared.
* pack.c (pack_unpack): Use rb_integer_unpack_2comp and
rb_integer_unpack.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e