Sha256: 0ed92ac4eda28103978f9369ecdef69270a694d646e2ac16435264ec1be897a8
Contents?: true
Size: 438 Bytes
Versions: 1
Compression:
Stored size: 438 Bytes
Contents
# frozen_string_literal: true require_relative './base' module Ssz class BitList < Base def initialize(bits, capacity:) @capacity = capacity @bits = bits end def serialize bb = ByteBuffer.from_bit_array(@bits.map{|b| b ? 1 : 0}) bb.bytes << 0 if bb.bytes.size < (@bits.size / 8) + 1 # extend buffer size bb.bytes[@bits.size / 8] |= 1 << (@bits.size % 8) bb.serialize end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ssz-0.1.0 | lib/ssz/bit_list.rb |