On Fri, 2003-11-14 at 12:00, Hans Franke wrote:
/* Fill a
block of memory with 0's. */
void foofill (start, end)
{
char *start, *end; /* memory pointers */
while (start < end) { /* until we reach the end... */
*start++= 0; /* write 0, incr pointer... */
}
}
So, where's the problem?
start and end are memory ponters, and thus belog to one
segemt.
So, why do you assume I should/must/want to address only within a
segment?
The whole operation is meaningless if they would
belong to different segments. The comparsion generated
for the while is a simple 16 bit compare.
...which technique [16-bit compare] will cause unpleasant side effects,
should the memory block be 65537 bytes long, for example.
BTW: above example is exactly one thing why I hate C.
basicly every compiler will generate a stupid loop, while
in assembly a REP STOSW would do the trick at maximum
speed possible.
Oh really....! OK you win!
EOT