The method is designed to extract data to an arbitrary type, and while
char * should probably be safe to do that with, conversion to char * is
not specified in C++ as it is in C, and compilers are becoming more
aggressive.
}
// Extract bytes from the buffer. The bytes remain in the buffer.
- void extract(char *dest, int index, int length) noexcept
+ void extract(void *dest, int index, int length) noexcept
{
index += cur_idx;
if (index >= SIZE) index -= SIZE;
// wrap-around copy
int half = SIZE - index;
std::memcpy(dest, buf + index, half);
- std::memcpy(dest + half, buf, length - half);
+ std::memcpy(reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(dest) + half),
+ buf, length - half);
}
else {
std::memcpy(dest, buf + index, length);