summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2007-02-21 01:43:24 +0100
committerAdrian Bunk <bunk@stusta.de>2007-02-21 01:43:24 +0100
commitc21af7af790184233f34077985ff160fe6b07d64 (patch)
treedf4a83b4ab526f8b7bf736c46c00f3b9420098ba
parent379efed186cb110913caa2014bf6cbc396e1fefb (diff)
[ATM] ambassador, firestream: "-1 >>" is implementation defined
6.5.7(5): The result of E1 >> E2 is E1 right-shifted E2 bit positions. ... If E1 has a signed type and a negative value, the resulting value is implementation defined. So, cast -1 to unsigned type to make result well-defined. [ Modified to use ~0U based upon recommendation from Al Viro. -DaveM ] Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Adrian Bunk <bunk@stusta.de>
-rw-r--r--drivers/atm/ambassador.c2
-rw-r--r--drivers/atm/firestream.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index 4b6bf19c39c0..15cb680b5ea4 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -978,7 +978,7 @@ static unsigned int make_rate (unsigned int rate, rounding r,
}
case round_up: {
// check all bits that we are discarding
- if (man & (-1>>9)) {
+ if (man & (~0U>>9)) {
man = (man>>(32-9)) + 1;
if (man == (1<<9)) {
// no need to check for round up outside of range
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 01eebd1ab80d..75bc1eb2d526 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -511,7 +511,7 @@ static unsigned int make_rate (unsigned int rate, int r,
}
case ROUND_UP: {
/* check all bits that we are discarding */
- if (man & (-1>>9)) {
+ if (man & (~0U>>9)) {
man = (man>>(32-9)) + 1;
if (man == (1<<9)) {
/* no need to check for round up outside of range */