MCPcopy Create free account
hub / github.com/ElementsProject/elements / BitsToBytes

Function BitsToBytes

src/merkleblock.cpp:12–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10
11
12std::vector<unsigned char> BitsToBytes(const std::vector<bool>& bits)
13{
14 std::vector<unsigned char> ret((bits.size() + 7) / 8);
15 for (unsigned int p = 0; p < bits.size(); p++) {
16 ret[p / 8] |= bits[p] << (p % 8);
17 }
18 return ret;
19}
20
21std::vector<bool> BytesToBits(const std::vector<unsigned char>& bytes)
22{

Callers 3

SERIALIZE_METHODSMethod · 0.85
FUZZ_TARGETFunction · 0.85
SERIALIZE_METHODSMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by 1

FUZZ_TARGETFunction · 0.68