Align On Boundry
Last updated on
I was working on converting some code to run with Emscripten, and I ran into an issue where where a static memory buffer didn’t align some objects, but needs to for JavaScript land. This was the solution.
uintptr_t
get_boundry_16(const uintptr_t addr) {
const uintptr_t addr_padded = addr + 15;
return addr_padded &~ 0x0F;
}