bs_is_aligned {bitstreamio}R Documentation

Is the current bit connection aligned at the given number of bits for reading/writing?

Description

Is the current bit connection aligned at the given number of bits for reading/writing?

Usage

bs_is_aligned(bs, nbits = 8)

Arguments

bs

Bistream connection object created with bs_open()

nbits

number of bits of alignment w.r.t start of bitstream. Default: 8

Value

logical. TRUE if stream location is currently aligned to the specified number of bits, otherwise FALSE

Examples

bs  <- bs_open(raw(), 'w')
bs_write_bit(bs, c(TRUE, FALSE, TRUE))
bs_is_aligned(bs, 8)
bs_align(bs, nbits = 8)
bs_is_aligned(bs, 8)
output <- bs_close(bs)
output

[Package bitstreamio version 0.1.0 Index]