* Ensures alignment of the position in the input stream by skipping * some input. * * @param alignment Alignment. Must be a power of 2. */
| 30 | * @param alignment Alignment. Must be a power of 2. |
| 31 | */ |
| 32 | void Align(size_t alignment = sizeof(void*)) { |
| 33 | Y_ASSERT(IsPowerOf2(alignment)); |
| 34 | |
| 35 | if (Position_ & (alignment - 1)) { |
| 36 | size_t len = alignment - (Position_ & (alignment - 1)); |
| 37 | |
| 38 | do { |
| 39 | len -= DoSkip(len); |
| 40 | } while (len); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | private: |
| 45 | size_t DoRead(void* ptr, size_t len) override; |
no test coverage detected