-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buffer allignment #1
Comments
@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): https://github.com/jcelerier/smallfunction/blob/master/smallfun/include/smallfun.hpp |
@jcelerier could we use |
well, in a lot of cases :p for instance pointers have to be aligned on a pointer size at least. eg: int main()
{
int x = 0;
struct
{
bool some_bool;
smallfun::SmallFun<int()> fun;
} b;
b.fun = [&x] { return x; };
return b.fun();
} compile:
results in
|
although I am no expert on alignment I believe the char buffer should be some kind of aligned storage
The text was updated successfully, but these errors were encountered: