Object
Very minimalistic, pure Ruby implementation of bit set. Inspired by java.util.BitSet, although significantly smaller in scope.
Clears all bits in the set @api public
# File lib/amqp/bit_set.rb, line 58 58: def clear 59: self.init_words(@nbits) 60: end
Fetches flag value for given bit.
@param [Integer] A bit to fetch @return [Boolean] true if given bit is set, false otherwise @api public
# File lib/amqp/bit_set.rb, line 38 38: def get(i) 39: w = self.word_index(i) 40: 41: (@words[w] & (1 << i)) != 0 42: end
Sets (flags) given bit. This method allows bits to be set more than once in a row, no exception will be raised.
@param [Integer] A bit to set @api public
# File lib/amqp/bit_set.rb, line 28 28: def set(i) 29: w = self.word_index(i) 30: @words[w] |= (1 << i) 31: end
Unsets (unflags) given bit. This method allows bits to be unset more than once in a row, no exception will be raised.
@param [Integer] A bit to unset @api public
# File lib/amqp/bit_set.rb, line 49 49: def unset(i) 50: w = self.word_index(i) 51: return if w.nil? 52: 53: @words[w] &= ~(1 << i) 54: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.