We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Components arrays for types with alignment of 64bytes+ are not aligned.
To Reproduce Edited hello_world example:
#include <hello_world.h> #include <iostream> #include <type_traits> #include <cstdint> // Component types struct alignas(256) Position { double x; double y; }; template <typename T> bool is_aligned(T* p) { return reinterpret_cast<std::uintptr_t>(p) % std::alignment_of<T>::value == 0; } int main(int, char *[]) { // Create the world flecs::world ecs; auto e = ecs.entity() .set(Position{4, 4}); std::cout << "Position alignment = " << std::alignment_of<Position>::value << "\n"; ecs.query<Position>() .run([=](flecs::iter iter) { while(iter.next()) { auto field = iter.field<Position>(0); std::cout << "Is aligned = " << is_aligned(&field[0]) << "\n"; } }); }
Expected behavior
Position alignment = 256 Is aligned = 1
Actual behavior
Position alignment = 256 Is aligned = 0
Additional context Compiler: gcc (GCC) 14.2.1 20240910
The text was updated successfully, but these errors were encountered:
Duplicate of #478
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Components arrays for types with alignment of 64bytes+ are not aligned.
To Reproduce
Edited hello_world example:
Expected behavior
Actual behavior
Additional context
Compiler: gcc (GCC) 14.2.1 20240910
The text was updated successfully, but these errors were encountered: