MCPcopy Create free account
hub / github.com/GJDuck/e9patch / bitstring

Function bitstring

src/e9patch/e9mapping.cpp:87–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85 */
86template <typename Key>
87static void bitstring(Key key, std::string &str)
88{
89 Key mask = 0xFFFFFFFFFFFFFFFFull;
90 for (unsigned i = 0; i < size(key); i += 2 * 64)
91 {
92 const char digs[] = "0123456789ABCDEF";
93 size_t count = 0;
94 for (unsigned j = 0; j < 2; j++)
95 {
96 uint64_t key64 = (key & mask).to_ullong();
97 count += __builtin_popcountll(key64);
98 key >>= 64;
99 }
100 switch (count)
101 {
102 case 0: case 1:
103 break;
104 default:
105 count = 1 + (count - 2) / 9; break;
106 }
107 str += digs[count];
108 }
109}
110template <>
111void bitstring<Key128>(Key128 key, std::string &str)
112{

Callers 1

collectMappingsFunction · 0.85

Calls 1

sizeFunction · 0.85

Tested by

no test coverage detected