4 ms·
The code can be made portable with a few simple macros (which is why they are implemented they way they are in GCC), though the optimizations will not be. From
by falcolas 12y ago
The code can be made portable with a few simple macros (which is why they are implemented they way they are in GCC), though the optimizations will not be.
From the Linux kernel:
struct boot_params boot_params __attribute__((aligned(16)));
#if !__GNUC__
#define __attribute__(x)
#endif
I think that's a better way to do it than ASM (which totally hoses your portability).
- pjmlp 12y agoFor alignment yes, but that is not the case across all extensions. Some of them are no different than just writing plain Assembly.
- falcolas 12y agoThe __builtin_ methods mentioned by the grandparent are functionally identical to the associated libc methods, so they can be #defined away as well.