swf: De-duplicate code in `count_sbits_twips()`
Re-use `count_sbits()`, as already done in `count_fbits()`.
This commit is contained in:
parent
2b9f0a6280
commit
84533e278d
|
@ -2386,16 +2386,7 @@ fn count_sbits(n: i32) -> u32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn count_sbits_twips(n: Twips) -> u32 {
|
fn count_sbits_twips(n: Twips) -> u32 {
|
||||||
let n = n.get();
|
count_sbits(n.get())
|
||||||
if n == 0 {
|
|
||||||
0
|
|
||||||
} else if n == -1 {
|
|
||||||
1
|
|
||||||
} else if n < 0 {
|
|
||||||
count_ubits((!n) as u32) + 1
|
|
||||||
} else {
|
|
||||||
count_ubits(n as u32) + 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn count_fbits(n: Fixed16) -> u32 {
|
fn count_fbits(n: Fixed16) -> u32 {
|
||||||
|
|
Loading…
Reference in New Issue