jsoncons
jsoncons copied to clipboard
fix: avoid over-allocating memory for 8 byte alignment or less
Fixes #509
Thanks!
Line 147
if (reinterpret_cast<uintptr_t>(ptr) % align == 0)
will fail compilation if ptr is a "fancy pointer". I don't have a test case for that, but you'll see it if you try to compile boost_examples/interprocess_allocator/shared_memory.cpp. I think you need to write it as
q = extension_traits::to_plain_pointer(ptr);
if (reinterpret_cast<uintptr_t>(q) % align == 0) {
Line 157
align_pad = (align-1);
requires a cast to suppress a warning.
@danielaparker PTAL
Thanks for contributing