replace and with test in boot0 to remove a mov

main
pantonshire 1 year ago
parent d362758b4d
commit 15d97a8d55

@ -104,12 +104,11 @@ main:
; - If each entry is smaller than a sector, an integer number of them will fit into a sector.
or eax, eax ; Test size != 0 because 128 * 2^n != 0
jz panic
and eax, 127 ; Test size is a multiple of 128
test eax, 127 ; Test size is a multiple of 128
jnz panic
; Use the (n & (n - 1)) == 0 trick to test if the entry size is a power of 2. Since we already
; know it's a nonzero multiple of 128, if size is a power of 2 then size = 128 * 2^n holds.
; Therefore we don't need to bother dividing by 128 first (shr 7), which saves a couple of bytes.
mov eax, ebx
mov ecx, ebx
dec ecx
and ecx, eax

Loading…
Cancel
Save