> > I'm not sure why Mycroft used '& ~(w)' in the above. Unless something
> > obvious escapes me, you can optimize the above down to 3
> > instructions. Both codepaths have a dependency chain of 3
> > instructions.
> >
> > #define word_has_nullbyte(w) ((((w) - 0x01010101) ^ (w)) & 0x80808080)
> >
>
> Hmm.. two things obviously escaped me:
>
> 1) The above fails horribly and detects 0x80 as a null.
It does not matter too much: you usually want
word_has_probably_nullbyte(), since you usually want to know where the
nullbyte is and copy rest byte-by-byte.
Pavel
-- I'm really pavel@atrey.karlin.mff.cuni.cz. Pavel Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu