mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-30 19:23:57 +00:00
fixes overflow defect when compiled with js backend (#25132)
Follow up to https://github.com/nim-lang/Nim/pull/25126.
This fixes overflow defect when `tests/stdlib/tstrutils.nim` was
compiled with js backend.
(cherry picked from commit 87dc1820c0)
This commit is contained in:
@@ -789,8 +789,8 @@ bar
|
||||
block: # formatSize
|
||||
disableVm:
|
||||
when hasWorkingInt64:
|
||||
doAssert formatSize(1024 * 1024 * 1024 * 2 - 1) == "1.999GiB"
|
||||
doAssert formatSize(1024 * 1024 * 1024 * 2) == "2GiB"
|
||||
doAssert formatSize(1024'i64 * 1024 * 1024 * 2 - 1) == "1.999GiB"
|
||||
doAssert formatSize(1024'i64 * 1024 * 1024 * 2) == "2GiB"
|
||||
doAssert formatSize((1'i64 shl 31) + (300'i64 shl 20)) == "2.293GiB" # <=== bug #8231
|
||||
doAssert formatSize(int64.high) == "7.999EiB"
|
||||
doAssert formatSize(int64.high div 2 + 1) == "4EiB"
|
||||
|
||||
Reference in New Issue
Block a user