Sha256: bc230bf5473b774bc9aadcf1713728deefad765323e394071dcb8bc412ef8caa
Contents?: true
Size: 349 Bytes
Versions: 6
Compression:
Stored size: 349 Bytes
Contents
# -*- coding: utf-8 -*- class Integer # Reverse bit. # # Example: # # 0.rbit #=> 0 # 1.rbit #=> 128 # 2.rbit #=> 64 # # The bit count defaults to 8. # # @param count [Integer] the count of bits to reverse # def rbit(count=8) z = self & 0 count.times{|i| z = z * 2 + self[i] } z end end
Version data entries
6 entries across 6 versions & 1 rubygems