swf: De-duplicate code in `count_sbits_twips()`

Re-use `count_sbits()`, as already done in `count_fbits()`.
This commit is contained in:
relrelb 2022-10-08 19:57:41 +05:45 committed by relrelb
parent 2b9f0a6280
commit 84533e278d
1 changed files with 1 additions and 10 deletions

View File

@ -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 {