Sha256: 4071e8609536e35fc5a73aa89793b89eb3e5a027d5607f71b08217dcab83f1db

Contents?: true

Size: 239 Bytes

Versions: 2

Compression:

Stored size: 239 Bytes

Contents

module Rips
  module Utils
    module IntegerExtension

      def to_bin(width)
        if self < 0
          '%0*b' % [width, (2**width-1) - ~self]
        else
          '%0*b' % [width, self]
        end
      end
    
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rips-0.1.1 lib/rips/utils/integer.rb
rips-0.1.0 lib/rips/utils/integer.rb