3 ms·
You are right. A lot of times you can rearrange the code in various ways, and the compiler will happily generate more efficient code. When that's not possible,
by ktRolster 9y ago
You are right. A lot of times you can rearrange the code in various ways, and the compiler will happily generate more efficient code.
When that's not possible, the way to keep it portable is by writing a generic C function, then writing an optimized version of the same function that will be compiled when that architecture is available.
At work it's rare to need to compile the same code for various architectures, but sometimes it happens.