[haiku-commits] Re: haiku: hrev43558 - src/system/libroot/posix/string

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 25 Dec 2011 09:35:47 +0100

On 2011-12-24 at 23:50:23 [+0100], marcus overhagen 
<marcusoverhagen@xxxxxxxxx> wrote:
> On Sat, Dec 24, 2011 at 10:30 PM,  <fredrik.holmqvist@xxxxxxxxx> wrote:
> > 753a02c: Reworked strlen and strnlen to look at four bytes at the time. 
> > From what I understand this should be safe.
> 
> > +       while (((uint32) s + i) & 3) {
> this is a problem when compiling for 64 bit, should be cast to addr_t first.
> 
> > +       const uint32 * end = (uint32 *) s + count;
> this appears to be broken

And the code contains so many coding style issues that I won't even bother to 
list them.

Moreover the strlen() implementation should simply use __builtin_strlen(), 
which -- I'd bet my X-mas presents -- is significantly faster on virtually 
all architectures.

CU, Ingo

Other related posts: