| 205 | } |
| 206 | |
| 207 | std::vector<unsigned char> GetMinimalFromIndices(std::vector<eh_index> indices, |
| 208 | size_t cBitLen) |
| 209 | { |
| 210 | assert(((cBitLen+1)+7)/8 <= sizeof(eh_index)); |
| 211 | size_t lenIndices { indices.size()*sizeof(eh_index) }; |
| 212 | size_t minLen { (cBitLen+1)*lenIndices/(8*sizeof(eh_index)) }; |
| 213 | size_t bytePad { sizeof(eh_index) - ((cBitLen+1)+7)/8 }; |
| 214 | std::vector<unsigned char> array(lenIndices); |
| 215 | for (size_t i = 0; i < indices.size(); i++) { |
| 216 | EhIndexToArray(indices[i], array.data()+(i*sizeof(eh_index))); |
| 217 | } |
| 218 | std::vector<unsigned char> ret(minLen); |
| 219 | CompressArray(array.data(), lenIndices, |
| 220 | ret.data(), minLen, cBitLen+1, bytePad); |
| 221 | return ret; |
| 222 | } |
| 223 | |
| 224 | template<size_t WIDTH> |
| 225 | StepRow<WIDTH>::StepRow(const unsigned char* hashIn, size_t hInLen, |