You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@odinthenerd good point. We probably need to align to the next power of two. Would be nice if someone could write a testcase for ARM as it does not support unaligned memory
hi, I've forked this for my own uses (and ended up rewriting most of it anyways :p ) ; for the alignment issue I've used the C++ alignas / alignof operator and passed the alignment as a template parameter ; that way, it can be checked at compile time just like the size (and can be tweaked by the user if necessary):
@jcelerier could we use std::allign and std::alligment_of to accomplish proper alignment?
Do you know in which cases the alignment needs to be adjusted?
Activity
nikhedonia commentedon Oct 11, 2017
@odinthenerd good point. We probably need to align to the next power of two. Would be nice if someone could write a testcase for ARM as it does not support unaligned memory
jcelerier commentedon Dec 31, 2017
hi, I've forked this for my own uses (and ended up rewriting most of it anyways :p ) ; for the alignment issue I've used the C++ alignas / alignof operator and passed the alignment as a template parameter ; that way, it can be checked at compile time just like the size (and can be tweaked by the user if necessary):
https://github.com/jcelerier/smallfunction/blob/master/smallfun/include/smallfun.hpp
nikhedonia commentedon Jan 4, 2018
@jcelerier could we use
std::allignandstd::alligment_ofto accomplish proper alignment?Do you know in which cases the alignment needs to be adjusted?
jcelerier commentedon Jan 4, 2018
well, in a lot of cases :p for instance pointers have to be aligned on a pointer size at least.
eg:
compile:
results in