Module: Origen::IntegerExtension
Instance Method Summary collapse
Instance Method Details
#[](*args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/origen/core_ext/integer.rb', line 7 def [](*args) if args.length == 1 && !args.first.is_a?(Range) super else if args.first.is_a?(Range) msb = args.first.first lsb = args.first.last else msb = args.first lsb = args.last end (self >> lsb) & 0.ones_comp(msb - lsb + 1) end end |