Optimizations in code #898
Replies: 1 comment
|
Hi Marcin, thanks for the time you spend on reading our code and starting this conversation! I think things like the one you are proposing are already easily taken care of by any modern C compiler when possible. See here for example. Even if it wasn't the case I would probably still vote for keeping the operation as-is as Last, we would be introducing troubles with signed integers. Those tricks work only for unsigned numbers. Take for example the following code: int main() {
printf("%d %d\n", 2 >> 3, 2 / 8);
printf("%d %d\n", -2 >> 3, -2 / 8);
return 0;
}This prints: Which is a bit weird, isn't it? :-) Regarding the |
Uh oh!
There was an error while loading. Please reload this page.
I saw that in many places there is for example:
These are small changes but I assume that the code is written in C because of performance
All reactions