internal/atlas: bug fix: possible overflowing on 32bit machines

This commit is contained in:
Hajime Hoshi 2023-08-19 01:19:15 +09:00
parent e270dea460
commit ea1f596cda

View File

@ -77,7 +77,7 @@ func putImagesOnSourceBackend(graphicsDriver graphicsdriver.Graphics) {
if i.usedAsSourceCount < math.MaxInt { if i.usedAsSourceCount < math.MaxInt {
i.usedAsSourceCount++ i.usedAsSourceCount++
} }
if i.usedAsSourceCount >= baseCountToPutOnSourceBackend*(1<<uint(min(i.usedAsDestinationCount, 31))) { if int64(i.usedAsSourceCount) >= int64(baseCountToPutOnSourceBackend*(1<<uint(min(i.usedAsDestinationCount, 31)))) {
i.putOnSourceBackend(graphicsDriver) i.putOnSourceBackend(graphicsDriver)
i.usedAsSourceCount = 0 i.usedAsSourceCount = 0
} }