Re: [PATCH] random: Create new rol32/ror32 bitops

From: Geert Uytterhoeven
Date: Thu Mar 10 2005 - 04:34:48 EST


On Tue, 8 Mar 2005, Linux Kernel Mailing List wrote:
> --- a/include/linux/bitops.h 2005-03-08 12:05:59 -08:00
> +++ b/include/linux/bitops.h 2005-03-08 12:05:59 -08:00
> @@ -134,4 +134,26 @@
> return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
> }
>
> +/*
> + * rol32 - rotate a 32-bit value left
> + *
> + * @word: value to rotate
> + * @shift: bits to roll
> + */
> +static inline __u32 rol32(__u32 word, int shift)
^^^
> +{
> + return (word << shift) | (word >> (32 - shift));
> +}
> +
> +/*
> + * ror32 - rotate a 32-bit value right
> + *
> + * @word: value to rotate
> + * @shift: bits to roll
> + */
> +static inline __u32 ror32(__u32 word, int shift)
^^^
> +{
> + return (word >> shift) | (word << (32 - shift));
> +}
> +
> #endif

`unsigned int', while we're at it?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
-
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/