Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Mar 6, 2022
1 parent 6ce9e79 commit 002b81e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/hmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ The full types with template parameters can be found in the [gtl/phmap_fwd_decl.

| type | memory usage | additional *peak* memory usage when resizing |
|-----------------------|-------------------|-----------------------------------------------|
| flat tables | ![flat_mem_usage](https://github.com/greg7mdp/gtl/blob/master/html/img/flat_mem_usage.png?raw=true) | ![flat_peak_usage](https://github.com/greg7mdp/gtl/blob/master/html/img/flat_peak.png?raw=true) |
| node tables | ![node_mem_usage](https://github.com/greg7mdp/gtl/blob/master/html/img/node_mem_usage.png?raw=true) | ![node_peak_usage](https://github.com/greg7mdp/gtl/blob/master/html/img/node_peak.png?raw=true) |
| flat tables | ![flat_mem_usage](https://github.com/greg7mdp/gtl/blob/main/html/img/flat_mem_usage.png?raw=true) | ![flat_peak_usage](https://github.com/greg7mdp/gtl/blob/main/html/img/flat_peak.png?raw=true) |
| node tables | ![node_mem_usage](https://github.com/greg7mdp/gtl/blob/main/html/img/node_mem_usage.png?raw=true) | ![node_peak_usage](https://github.com/greg7mdp/gtl/blob/main/html/img/node_peak.png?raw=true) |


- *size()* is the number of values in the container, as returned by the size() method
Expand Down
4 changes: 3 additions & 1 deletion gtl/bit_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ class view {
size_t num_bytes = (size() + 7) >> 3;
size_t start = res.size();
size_t cur = start + num_bytes * 2;
res.resize(cur);
res.resize(cur); // resize string as we display bits right to left, lsb is the rightmost

auto to_hex = [](unsigned char b) -> char { return (b > 9) ? 'a' + b - 10 : '0' + b; };
typename S::bit_sequence seq(_bv.storage(), _first, _last, 0);
Expand All @@ -663,6 +663,8 @@ class view {
for (size_t i=0; i<8; ++i) {
if (cur == start)
break;

// lsb is rightmost... populate string from the end
unsigned char b = (unsigned char)v;
v >>= 8;
res[--cur] = to_hex(b & 0xf);
Expand Down

0 comments on commit 002b81e

Please sign in to comment.