Shopify / measured

Encapsulate measurements and their units in Ruby and Ruby on Rails.
MIT License
337 stars 28 forks source link

Replace Fixnum/Bignum with Integer #54

Closed thegedge closed 7 years ago

thegedge commented 7 years ago

Ruby 2.4 unified Fixnum and Bignum under Integer [1], both of which were subclasses of Integer pre-2.4.

One small bonus of this is that a simpler when clause means we'll actually be faster. Here's the instructions for just when Integer:

0006 dup                                                              (   3)
0007 getinlinecache   14, <is:0>
0010 getconstant      :Integer
0012 setinlinecache   <is:0>
0014 checkmatch       2
0016 branchif         45

and here are the instructions for when Fixnum, Bignum

0018 dup                                                              (   5)
0019 getinlinecache   26, <is:1>
0022 getconstant      :Fixnum
0024 setinlinecache   <is:1>
0026 checkmatch       2
0028 branchif         50
0030 dup
0031 getinlinecache   38, <is:2>
0034 getconstant      :Bignum
0036 setinlinecache   <is:2>
0038 checkmatch       2
0040 branchif         50

[1] http://blog.bigbinary.com/2016/11/18/ruby-2-4-unifies-fixnum-and-bignum-into-integer.html