Fix set_bits

This commit is contained in:
kwolekr 2015-03-31 23:30:44 -04:00
parent 337e79c656
commit 699e066bea

@ -258,7 +258,7 @@ inline u32 get_bits(u32 x, u32 pos, u32 len)
inline void set_bits(u32 *x, u32 pos, u32 len, u32 val) inline void set_bits(u32 *x, u32 pos, u32 len, u32 val)
{ {
u32 mask = (1 << len) - 1; u32 mask = (1 << len) - 1;
*x &= ~(mask << len); *x &= ~(mask << pos);
*x |= (val & mask) << pos; *x |= (val & mask) << pos;
} }