Re: [PATCH 7/7] lib/random32.c: Remove redundant U suffixes on integers

From: Daniel Borkmann
Date: Sun Jun 08 2014 - 06:36:34 EST


[ Please also Cc Hannes in your series. ]

On 06/07/2014 10:31 AM, George Spelvin wrote:
Get rid of a few of the extraneous U suffixes on ordinary integers.

Signed-off-by: George Spelvin <linux@xxxxxxxxxxx>
---
lib/random32.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/random32.c b/lib/random32.c
index 9cc410dd..ad0c2ed1 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -58,10 +58,10 @@ u32 prandom_u32_state(struct rnd_state *state)
{
#define TAUSWORTHE(s,a,b,c,d) ((s&c)<<d) ^ (((s <<a) ^ s)>>b)

- state->s1 = TAUSWORTHE(state->s1, 6U, 13U, 4294967294U, 18U);
- state->s2 = TAUSWORTHE(state->s2, 2U, 27U, 4294967288U, 2U);
- state->s3 = TAUSWORTHE(state->s3, 13U, 21U, 4294967280U, 7U);
- state->s4 = TAUSWORTHE(state->s4, 3U, 12U, 4294967168U, 13U);
+ state->s1 = TAUSWORTHE(state->s1, 6, 13, 4294967294U, 18);
+ state->s2 = TAUSWORTHE(state->s2, 2, 27, 4294967288U, 2);
+ state->s3 = TAUSWORTHE(state->s3, 13, 21, 4294967280U, 7);
+ state->s4 = TAUSWORTHE(state->s4, 3, 12, 4294967168U, 13);

I don't see the point in why we _need_ to change this here.

return (state->s1 ^ state->s2 ^ state->s3 ^ state->s4);
}
@@ -77,9 +77,8 @@ EXPORT_SYMBOL(prandom_u32_state);
u32 prandom_u32(void)
{
struct rnd_state *state = &get_cpu_var(net_rand_state);
- u32 res;
+ u32 res = prandom_u32_state(state);

- res = prandom_u32_state(state);
put_cpu_var(state);

Ditto.

return res;

--
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/