zy1000: fix bug when running on non-arm CPU

Shifting by more than 32 is undefined for 32 bit integers according
to the C standard. Robust solution is conditional code.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
__archive__
Øyvind Harboe 2009-11-12 10:10:11 +01:00
parent b888b63fe9
commit 83104648e6
1 changed files with 8 additions and 1 deletions

View File

@ -509,7 +509,14 @@ static __inline void scanFields(int num_fields, const struct scan_field *fields,
}
}
/* mask away unused bits for easier debugging */
value&=~(((uint32_t)0xffffffff) << k);
if (k < 32)
{
value&=~(((uint32_t)0xffffffff) << k);
} else
{
/* Shifting by >= 32 is not defined by the C standard
* and will in fact shift by &0x1f bits on nios */
}
shiftValueInner(shiftState, pause_state, k, value);