| 407 | } |
| 408 | |
| 409 | void ByteMapBuilder::Build(uint8_t* bytemap, int* bytemap_range) { |
| 410 | // Assign byte classes numbered from 0. |
| 411 | nextcolor_ = 0; |
| 412 | |
| 413 | int c = 0; |
| 414 | while (c < 256) { |
| 415 | int next = splits_.FindNextSetBit(c); |
| 416 | uint8_t b = static_cast<uint8_t>(Recolor(colors_[next])); |
| 417 | while (c <= next) { |
| 418 | bytemap[c] = b; |
| 419 | c++; |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | *bytemap_range = nextcolor_; |
| 424 | } |
| 425 | |
| 426 | int ByteMapBuilder::Recolor(int oldcolor) { |
| 427 | // Yes, this is a linear search. There can be at most 256 |
no test coverage detected