Furrent
Namespaces | Functions | Variables
bitfield.cpp File Reference
#include "download/bitfield.hpp"
#include <stdexcept>
Include dependency graph for bitfield.cpp:

Namespaces

 fur
 Common types used in all the project.
 
 fur::download
 
 fur::download::bitfield
 

Functions

int64_t byte_index (int64_t bit_index)
 What byte contains the bit at bit_index? More...
 
int64_t byte_offset (int64_t bit_index)
 
void assert_within_bounds (int64_t len, int64_t index)
 Throws an exception if index is not within the bounds of the bitfield. More...
 
std::ostream & fur::download::bitfield::operator<< (std::ostream &os, const Bitfield &bf)
 

Variables

const uint8_t INDEX_ZERO = 0 | (1 << 7)
 

Function Documentation

◆ assert_within_bounds()

void assert_within_bounds ( int64_t  len,
int64_t  index 
)

Throws an exception if index is not within the bounds of the bitfield.

◆ byte_index()

int64_t byte_index ( int64_t  bit_index)

What byte contains the bit at bit_index?

◆ byte_offset()

int64_t byte_offset ( int64_t  bit_index)

How many bits from the beginning of the correct byte does the bit at bit_index live?

Variable Documentation

◆ INDEX_ZERO

const uint8_t INDEX_ZERO = 0 | (1 << 7)