On Fri, 6 Dec 2013, Konstantin Vladimirov wrote:
Consider code:
int foo(char *t, char *v, int w)
{
int i;
for (i = 1; i != w; ++i)
{
int x = i << 2;
A side note, but something too few people seem to be aware of: writing
i<<2 can pessimize code compared to i*4 (and it is never faster). That is
because, at a high level, signed multiplication overflow is undefined
behavior while shift isn't. At a low level, gcc knows it can implement *4
as a shift anyway.
v[x + 4] = t[x + 4];
}
return 0;
}
--
Marc Glisse