/// halves method in loop
void prb0 (unsigned *begin, unsigned count)
{
// usual Duff's device works worse than the decoupled code
// unrolled loop works better than normal loop
if (count)
{
switch (count & 3)
{
case 3: *begin = rbH5 (*begin); ++begin;
case 2: *begin = rbH5 (*begin); ++begin;
case 1: *begin = rbH5 (*begin); ++begin;
default: ;// continue
}
for (unsigned n = count >> 2, i = 0; n != 0; i += 4, --n)
{
begin[i] = rbH5 (begin[i]);
begin[i + 1] = rbH5 (begin[i + 1]);
begin[i + 2] = rbH5 (begin[i + 2]);
begin[i + 3] = rbH5 (begin[i + 3]);
}
}
}