javascript
Brief description  about Online courses   join in Online courses
View AISHWARYA  SRIKANTHAN 's Profile

loop

What is loop unrolling?
Asked by AISHWARYA SRIKANTHAN | Aug 5, 2010 |  Reply now
Replies (1)
View embedded instructor 's Profile
Small loops can be unrolled for higher performance, with the disadvantage of increased codesize. When a loop is unrolled, a loop counter needs to be updated less often and fewer branches are executed. If the loop iterates only a few times, it can be fully unrolled,
so that the loop overhead completely disappears.
eg:
int countbit1(uint n)
{ int bits = 0;
while (n != 0)
{
if (n & 1) bits++;
n >&
Aug 5, 2010