From: ko1@... Date: 2018-12-26T00:38:08+00:00 Subject: [ruby-core:90720] [Ruby trunk Bug#15460] Behaviour of String#setbyte changed Issue #15460 has been updated by ko1 (Koichi Sasada). FYI ``` 7213568733f673da0d82f95e8a1bccf79ba3f0d3 Author: shyouhei Date: Mon Nov 19 09:52:46 2018 +0000 string.c: setbyte silently ignores upper bits The behaviour of String#setbyte has been depending on the width of int, which is not portable. Must check explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e :100644 100644 5a5cbb576c31350a416b2121e5efb85aaffa0676 e55c59136a49fb7d2d70805a65a4c7f56519f2e9 M string.c :040000 040000 2170f3be4ac9d27e26ce361c38beb7874c07436f e71fc9f00ed5602a30e9f504fc015b9bf7b4dad1 M test ``` ---------------------------------------- Bug #15460: Behaviour of String#setbyte changed https://bugs.ruby-lang.org/issues/15460#change-75897 * Author: gettalong (Thomas Leitner) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- I just installed Ruby 2.6.0 for benchmarking reasons and found that the change [string.c: setbyte silently ignores upper bits](https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/65804) broke my library/application HexaPDF. Before using String#setbyte I tested how it would respond to values lower than 0 or greater than 255 and found that it automatically performed the needed modulo 256 operation (at least up to Ruby 2.5.3). Therefore I left out the explicit modulo operation for performance reasons. Would it make sense to change the String#setbyte implementation to perform the modulo operation? This would restore compatibility with prior Ruby versions and may be what people would expect. -- https://bugs.ruby-lang.org/ Unsubscribe: