Re: C and side-effects

From: George Anzinger (george@pioneer.net)
Date: Thu May 04 2000 - 04:50:12 EST


 I wrote:

c = (c - d)>>n + d;

and tested for values of 0 < c < 40, 1 < d < 40 and 0 < n < 80.

Turns out that gcc (and the hardware) tend to give unexpected results
for n>32. I think the shift is done modulo 32. What does the standard
have to say about this?

In case you are wondering, this bit of code computes the time slice (c)
for a process with priority d/2 that has been blocked for n time slice
updates in linux. Works fine as long as n<32. For n>32 it should
evaluate to d-1.

George

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



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:14 EST