Re: [TRIVIAL] kstrdup

Kai Henningsen (kaih@khms.westfalen.de)
19 Apr 2003 13:45:00 +0200


root@chaos.analogic.com (Richard B. Johnson) wrote on 18.04.03 in <Pine.LNX.4.53.0304181512220.22901@chaos>:

> The test for every byte transferred is, quite obviously, correct.
> It is also, quite obviously, non optimum.

Actually, that is very much not obvious.

Especially if you're familiar with architectures where every move has an
implicit test (typically for zero and sign), and so checking for the zero
byte during the move is quite obviously the only sane thing to do - the
version with a count is slower, because the inner loop does more. (Those
architectures typically don't have a REP-style prefix.)

MfG Kai
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/