diff options
-rw-r--r-- | include/bitfield.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/bitfield.h b/include/bitfield.h index ec4815c8e05..b884c746001 100644 --- a/include/bitfield.h +++ b/include/bitfield.h @@ -54,5 +54,5 @@ static inline uint bitfield_replace(uint reg_val, uint shift, uint width, { uint mask = bitfield_mask(shift, width); - return (reg_val & ~mask) | (bitfield_val << shift); + return (reg_val & ~mask) | ((bitfield_val << shift) & mask); } |