Fixed a integer overflow

This commit is contained in:
dario 2024-06-24 14:38:16 +02:00
parent 80fed4bc44
commit 29482e94ff

View File

@ -147,7 +147,8 @@ namespace sta
while (left <= right)
{
middle = (left + right) / 2;
uint32_t sector = ((middle * (sizeof(T)+1)) / W25QXX_SECTOR_SIZE);
uint32_t address = middle * (sizeof(T)+1);
uint32_t sector = (sector / W25QXX_SECTOR_SIZE);
flash_->sectorErase(sector * W25QXX_SECTOR_SIZE, true);
right = middle;