Return the nth bit from a bitstring. * * Precondition: NULL != s * n < s->len; */
| 29 | * n < s->len; |
| 30 | */ |
| 31 | static inline bool getBit(const bitstring *s, size_t n) { |
| 32 | size_t total_offset = s->offset + n; |
| 33 | simplicity_assert(n < s->len); |
| 34 | return 1 & (s->arr[total_offset / CHAR_BIT] >> (CHAR_BIT - 1 - (total_offset % CHAR_BIT))); |
| 35 | } |
| 36 | |
| 37 | /* Return 8 bits from a bitstring staring from the nth bit. |
| 38 | * |
no outgoing calls
no test coverage detected