Optimization: Use constant folding for divisions not a power of two (#9609)

This commit is contained in:
zwim
2022-10-10 22:21:27 +02:00
committed by GitHub
parent a24548ed3f
commit 4969811c08
40 changed files with 118 additions and 118 deletions

View File

@@ -433,10 +433,10 @@ function ReaderMenu:_getTabIndexFromLocation(ges)
if not ges then
return self.last_tab_index
-- if the start position is far right
elseif ges.pos.x > 2 * Screen:getWidth() / 3 then
elseif ges.pos.x > Screen:getWidth() * (2/3) then
return BD.mirroredUILayout() and 1 or #self.tab_item_table
-- if the start position is far left
elseif ges.pos.x < Screen:getWidth() / 3 then
elseif ges.pos.x < Screen:getWidth() * (1/3) then
return BD.mirroredUILayout() and #self.tab_item_table or 1
-- if center return the last index
else