mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
Fixes an issue where importing the `strutils` module, or any other
importing the `strutils` module, ends up with a compile time error on
platforms where ints are less then 32-bit wide.
The fix follows the suggestions made in #23125.
(cherry picked from commit 15c7b76c66)
This commit is contained in:
@@ -846,7 +846,12 @@ proc cmpRunesIgnoreCase*(a, b: openArray[char]): int {.rtl, extern: "nuc$1".} =
|
||||
# slow path:
|
||||
fastRuneAt(a, i, ar)
|
||||
fastRuneAt(b, j, br)
|
||||
result = RuneImpl(toLower(ar)) - RuneImpl(toLower(br))
|
||||
when sizeof(int) < 4:
|
||||
const lo = low(int).int32
|
||||
const hi = high(int).int32
|
||||
result = clamp(RuneImpl(toLower(ar)) - RuneImpl(toLower(br)), lo, hi).int
|
||||
else:
|
||||
result = RuneImpl(toLower(ar)) - RuneImpl(toLower(br))
|
||||
if result != 0: return
|
||||
result = a.len - b.len
|
||||
|
||||
|
||||
Reference in New Issue
Block a user