Sha256: 5031e7c9c77001ba17b1342bbfba7c6f23b845a4cc29481df90cac7efe47fa72

Contents?: true

Size: 311 Bytes

Versions: 3

Compression:

Stored size: 311 Bytes

Contents

module Slatan
  module Utils
    module IntegerEx
      refine Integer.singleton_class do
        def max()
          n_bytes = [42].pack('i').size
          n_bits = n_bytes * 16
          2 ** (n_bits - 2) - 1
        end

        def min()
          -(self.max()) - 1
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slatan-0.2.2 lib/slatan/utils/integer_ex.rb
slatan-0.2.0 lib/slatan/utils/integer_ex.rb
slatan-0.1.0 lib/slatan/utils/integer_ex.rb