ruby-protobuf
ruby-protobuf copied to clipboard
INT64_MAX, INT64_MIN, possibly others, initialized wrong on OS X's ruby
In lib/protobuf/message/field.rb, there's some constants set up like this:
INT32_MAX = 2**31 - 1
INT32_MIN = -2**31
INT64_MAX = 2**63 - 1
INT64_MIN = -2**63
UINT32_MAX = 2**32 - 1
UINT64_MAX = 2**64 - 1
The problem is that with OS X's ruby (on Mountain Lion, anyway), we get this:
$ /usr/bin/ruby -e 'puts 2**63'
-9223372036854775808
Yep. Its ruby can't do math good. The ruby --version is ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
.
It would be very nice if all these expressions were replaced by hard-coded integer literals.