I have this peace of code and I would like to make it as fast as possible.
I am not an experienced c++ developer so I would love to know if you guys come up with some really good reinplementation of this algorithm since I removed all the assignments thinking it was a good thing to do...
And now I don't really know if that was the best thing to do.
So, what is faster?
for(register uint pPos = 0; pPos < size; pPos++) {
img->setPixel(pPos % dst_w, pPos / dst_w,
buffer32[
sf * (
(pPos / dst_w * src_w) +
(pPos % dst_w)
)
]);
}
or
for(register uint pPos = 0, x = 0, y = 0; pPos < size; pPos++) {
x = pPos % dst_w;
y = pPos / dst_w;
img->setPixel(x, y,
buffer32[
sf * (
(y * src_w) + x
)
]);
}
Side note: I really thought it was a good thing to ask, I don't understand the down votes.
Also thank you all for the comments, learned a lot.