8 Nov
2002
8 Nov
'02
5:39 p.m.
Back in the early days of compiler benchmarks, one fancy compiler noticed that the result of a lengthy calculation wasn't being used, and dutifully removed the calculations. That calculation was, of course, the kernel of the benchmark. The solution was to print the result.
Or you do something like using binary OR from both ends of the
memory chunk simultaneously, so when they finish, you're guaranteed to
have 0xff (all 1's) all over your memory.
This is off the top of my head, so bugs may exist, etc.
int zapmem(uint8 *mem, size_t size)
{
int i,j,a,b;
for (a=0xaa,b=0x55,i=0, j=size-1; i