[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bitrotate

From: Paul Eggert
Subject: Re: bitrotate
Date: Thu, 28 Aug 2008 14:56:43 -0700
User-agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux)

Simon Josefsson <address@hidden> writes:

> +#define rotl32(x,n) \
> +  ((((x) << ((uint16_t)(n))) | ((x) >> (32 - (uint16_t)(n)))) & 0xFFFFFFFF)

I suggest using inline functions rather than macros, to avoid hassles
with double-evaluating arguments.  That way, you won't need any casts.
The casts in this code are not right, anyway; in C, the shift count N
is supposed to be of type int, regardless of the type of the value X
being shifted.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]