forked from Mirrorlandia_minetest/minetest
Fix set_bits
This commit is contained in:
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user