
Hi ya,
I could not understand common/memsize.c, how it works?
Like a charm ;)
maxsize / sizeof (long), what's meaning of it? why sizeof (long) is dividend?
As the comment in line 50 states, "cnt" is used in pointer arithmetic, so addr is increased in sizeof(long) bytes. maxsize however is considered to be in bytes only. Makes sense?
just like stack, push every step mem addr to save:
save[i++] = *addr; and then?
Cannot parse the question.
The algorithm should be pretty clear however (take a paper and pencil and work out the values of addr as it proceeds) - we save the original content of the adressed cells and write our own pattern there (~cnt). Then we walk these cells upward and see where the previous write did not work like it was supposed to - voila.
Cheers Detlev