3 ms·
"The pointer version still has to test for the nul character anyway, right?" Some architectures set the zero flag on memory loads. I think the PDP is one of th
by Someone 10y ago
"The pointer version still has to test for the nul character anyway, right?"
Some architectures set the zero flag on memory loads. I think the PDP is one of them. Google gives me https://groups.google.com/forum/m/#!topic/net.lang.c/LKAYbzXMDew https://groups.google.com/forum/m/#!topic/net.lang.c/LKAYbzX..., which claims that
while (*ra++ = *rb++);
compiles to
L16:
movb (r10)+,(r11)+
jeql L17
jbr L16
L17:
If you do i != len, you need an extra comparison instruction.
- groovy2shoes 10y agoAh! Interesting. Thank you :)