Sha256: a35004ad2b9e4213696cb66bedd237f9cc5e18d9485414fb0c14c6ecc40c2a26
Contents?: true
Size: 402 Bytes
Versions: 1
Compression:
Stored size: 402 Bytes
Contents
# frozen_string_literal: true module Lrama module Bitmap def self.from_array(ary) bit = 0 ary.each do |int| bit |= (1 << int) end bit end def self.to_array(int) a = [] #: Array[Integer] i = 0 while int > 0 do if int & 1 == 1 a << i end i += 1 int >>= 1 end a end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lrama-0.6.11 | lib/lrama/bitmap.rb |