replace and with test in boot0 to remove a mov
This commit is contained in:
1 parent
d362758b4d
commit
15d97a8d55
1 file changed
+1
-2
@@ -104,12 +104,11 @@ main:
|
|||||||
; - If each entry is smaller than a sector, an integer number of them will fit into a sector.
|
; - 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
|
or eax, eax ; Test size != 0 because 128 * 2^n != 0
|
||||||
jz panic
|
jz panic
|
||||||
and eax, 127 ; Test size is a multiple of 128
|
test eax, 127 ; Test size is a multiple of 128
|
||||||
jnz panic
|
jnz panic
|
||||||
; Use the (n & (n - 1)) == 0 trick to test if the entry size is a power of 2. Since we already
|
; 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.
|
; 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.
|
; 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
|
mov ecx, ebx
|
||||||
dec ecx
|
dec ecx
|
||||||
and ecx, eax
|
and ecx, eax
|
||||||
|
|||||||
Reference in new issue
Block a user