/* See LICENSE file for copyright and license details. */ #include "common.h" void shiftbuffer(struct algorithm *algorithms, size_t nalgorithms, struct buffer *buffer) { size_t i, consumed = SIZE_MAX; for (i = 0; i < nalgorithms; i++) consumed = MIN(consumed, algorithms[i].offset); if (!consumed) return; for (i = 0; i < nalgorithms; i++) algorithms[i].offset -= consumed; memmove(&buffer->buf[0], &buffer->buf[consumed], buffer->length -= consumed); }