mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 08:41:34 +11:00
add set bits function
This commit is contained in:
parent
353fa23876
commit
5cdcfcc0b3
|
@ -46,6 +46,11 @@ impl ObjectStandard {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_bits(current: u16, value: u16, length: u16, shift: u16) -> u16 {
|
||||||
|
let mask: u16 = (1 << length) - 1;
|
||||||
|
(current & !(mask << shift)) | ((value & mask) << shift)
|
||||||
|
}
|
||||||
|
|
||||||
pub struct ObjectAttribute {
|
pub struct ObjectAttribute {
|
||||||
a0: u16,
|
a0: u16,
|
||||||
a1: u16,
|
a1: u16,
|
||||||
|
|
Loading…
Reference in a new issue