Re: While we're at it
Colm MacCárthaigh <[email protected]> Thu, 1 Apr 2010 12:52:20 -0700
| Newsgroups | gmane.network.djbdns |
|---|---|
| Message-ID | <[email protected]> |
2010/4/1 Dean Anderson <[email protected]>: > Clue: How many bytes fit in a word? The start of the array is probably > word-aligned. A really good compiler might even figure out that it can > load the word in a register and test all at once. Sadly, not. As I said in my reply, I can find no evidence of this in my analysis of machine code. Note that alignment is a tricky problem, it would have to scroll until the tests were word-aligned. See method 4 in the cited post; http://www.stdlib.net/~colmmacc/2009/03/01/optimising-strlen/ for such an example implementation (from glibc). This is quite far beyond the capabilities of static compile optimization, I doubt it would even be all that useful. -- Colm