mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 02:12:11 +00:00
Change unicode lookup tables to have int32 elements to support platforms where sizeof(int) < 4 (#23433)
Fixes an issue that comes up when using strutils.`%` or any other
strutils/strformat feature that uses the unicode lookup tables behind
the scenes, on systems where ints are than 32-bit wide.
Tested with:
```bash
./koch test cat lib
```
Refer to the discussion in #23125.
(cherry picked from commit 4c38569229)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
const
|
||||
toLowerRanges = [
|
||||
0x00041, 0x0005A, 532,
|
||||
0x00041'i32, 0x0005A, 532,
|
||||
0x000C0, 0x000D6, 532,
|
||||
0x000D8, 0x000DE, 532,
|
||||
0x00189, 0x0018A, 705,
|
||||
@@ -50,7 +50,7 @@ const
|
||||
]
|
||||
|
||||
toLowerSinglets = [
|
||||
0x00100, 501,
|
||||
0x00100'i32, 501,
|
||||
0x00102, 501,
|
||||
0x00104, 501,
|
||||
0x00106, 501,
|
||||
@@ -663,7 +663,7 @@ const
|
||||
]
|
||||
|
||||
toUpperRanges = [
|
||||
0x00061, 0x0007A, 468,
|
||||
0x00061'i32, 0x0007A, 468,
|
||||
0x000E0, 0x000F6, 468,
|
||||
0x000F8, 0x000FE, 468,
|
||||
0x0023F, 0x00240, 11315,
|
||||
@@ -712,7 +712,7 @@ const
|
||||
]
|
||||
|
||||
toUpperSinglets = [
|
||||
0x000B5, 1243,
|
||||
0x000B5'i32, 1243,
|
||||
0x000FF, 621,
|
||||
0x00101, 499,
|
||||
0x00103, 499,
|
||||
@@ -1339,7 +1339,7 @@ const
|
||||
]
|
||||
|
||||
toTitleSinglets = [
|
||||
0x001C4, 501,
|
||||
0x001C4'i32, 501,
|
||||
0x001C6, 499,
|
||||
0x001C7, 501,
|
||||
0x001C9, 499,
|
||||
@@ -1350,7 +1350,7 @@ const
|
||||
]
|
||||
|
||||
alphaRanges = [
|
||||
0x00041, 0x0005A,
|
||||
0x00041'i32, 0x0005A,
|
||||
0x00061, 0x0007A,
|
||||
0x000C0, 0x000D6,
|
||||
0x000D8, 0x000F6,
|
||||
@@ -1824,7 +1824,7 @@ const
|
||||
]
|
||||
|
||||
alphaSinglets = [
|
||||
0x000AA,
|
||||
0x000AA'i32,
|
||||
0x000B5,
|
||||
0x000BA,
|
||||
0x002EC,
|
||||
@@ -1974,7 +1974,7 @@ const
|
||||
]
|
||||
|
||||
spaceRanges = [
|
||||
0x00009, 0x0000D,
|
||||
0x00009'i32, 0x0000D,
|
||||
0x00020, 0x00020,
|
||||
0x00085, 0x00085,
|
||||
0x000A0, 0x000A0,
|
||||
|
||||
@@ -464,7 +464,7 @@ proc `==`*(a, b: Rune): bool =
|
||||
|
||||
include "includes/unicode_ranges"
|
||||
|
||||
proc binarySearch(c: RuneImpl, tab: openArray[int], len, stride: int): int =
|
||||
proc binarySearch(c: RuneImpl, tab: openArray[int32], len, stride: int): int =
|
||||
var n = len
|
||||
var t = 0
|
||||
while n > 1:
|
||||
|
||||
Reference in New Issue
Block a user