• David S. Miller's avatar
    sparc: Optimize strncpy_from_user() zero byte search. · 4efcac3a
    David S. Miller authored
    Compute a mask that will only have 0x80 in the bytes which
    had a zero in them.  The formula is:
    
    	~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | x | 0x7f7f7f7f)
    
    In the inner word iteration, we have to compute the "x | 0x7f7f7f7f"
    part, so we can reuse that in the above calculation.
    
    Once we have this mask, we perform divide and conquer to find the
    highest 0x80 location.
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    4efcac3a
usercopy.c 3.16 KB