| 382 | } |
| 383 | |
| 384 | static inline void |
| 385 | set_bit(uint8_t *ptr, uint32_t bit, uint32_t pos) |
| 386 | { |
| 387 | uint32_t byte_idx = pos / CHAR_BIT; |
| 388 | /* index of the bit int byte, indexing starts from MSB */ |
| 389 | uint32_t bit_idx = (CHAR_BIT - 1) - (pos & (CHAR_BIT - 1)); |
| 390 | uint8_t tmp; |
| 391 | |
| 392 | tmp = ptr[byte_idx]; |
| 393 | tmp &= ~(1 << bit_idx); |
| 394 | tmp |= bit << bit_idx; |
| 395 | ptr[byte_idx] = tmp; |
| 396 | } |
| 397 | |
| 398 | /** |
| 399 | * writes m-sequence to the hash_key for range [start, end] |
no outgoing calls
no test coverage detected