Subject: Re: Bugs in str* routines (pr port-pc532/7709, port-pc532/7710)
To: Ian Dall <Ian.Dall@dsto.defence.gov.au>
From: Dave Rand <dlr@above.net>
List: port-pc532
Date: 06/05/1999 08:38:21
[In the message entitled "Bugs in str* routines (pr port-pc532/7709, port-pc532/7710)" on Jun  5, 23:33, Ian Dall writes:]
> This raises a couple of questions. If the double word at a time
> approach is a win, why isn't it used for strncpy and strncmp. OK you
> need a bit of extra code to keep count, but not that much. The second
> question is are these "smart" algorithms worth it anyway? They look as
> though they have quite a bit of extra overhead for short strings and I
> would have though that short strings were more common than long ones.
> Anyone really concerned with efficient handling of long strings, probably
> shouldn't be using null terminated ones anyway!
> 

These tricks are used to increase the performance on certain benchmarks.
They are almost always (anything more than 2 bytes) a win.

Yes, if you approach the end of a page, Bad Things can happen.


-- 
Dave Rand
CTO, Above.net
NASDAQ: ABOV