Am 14 Nov 2003 11:49 meinte Tom Jennings:
On Fri, 2003-11-14 at 05:45, Eric Smith wrote:
Hans wrote:
> The value of the segment has no meaning - why do people
> always waste their time in calculateing 'real' addresses?
> I don't care for that on a /370, nor on a PDP 11, so why
> should I do so on my PC?
/* 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. The whole operation is meaningless if they would
belong to different segments. The comparsion generated
for the while is a simple 16 bit compare.
A Program has not to assume anything about segments,
except that it owns it (or has the access right) and
how long it is.
Gruss
H.
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.
--
VCF Europa 5.0 am 01./02. Mai 2004 in Muenchen
http://www.vcfe.org/