Re: [PATCH] tile: optimize strnlen using SIMD instructions

From: Max Filippov
Date: Thu Aug 01 2013 - 16:43:21 EST


Hi Ken,

On Thu, Aug 1, 2013 at 11:55 PM, Ken Steele <ken@xxxxxxxxxx> wrote:
> + /* Read the first word, but force bytes before the string to be nonzero.
> + * This expression works because we know shift counts are taken mod 32.
> + */
> + v = *p | ((1 << (s_int << 3)) - 1);

This expression potentially has undefined behaviour according to C99, 6.5.7:3.
IOW it may work, but it doesn't always have to.

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