diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-08-10 07:18:49 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-08-10 07:43:14 -0400 |
| commit | 5d5addd48fef09132c08e4b570675491dd5cdb76 (patch) | |
| tree | de6238db0d4600397f6314761ecaf4aed907267a /core/bytes | |
| parent | c69fa87d53297325d235d1a5ff57d84655ae2217 (diff) | |
Set `SIMD_SCAN_WIDTH` based on `size_of(uintptr)`
Diffstat (limited to 'core/bytes')
| -rw-r--r-- | core/bytes/bytes.odin | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/core/bytes/bytes.odin b/core/bytes/bytes.odin index e09859a19..8e7bc01bd 100644 --- a/core/bytes/bytes.odin +++ b/core/bytes/bytes.odin @@ -6,14 +6,30 @@ import "core:unicode" import "core:unicode/utf8" -@private SIMD_SCAN_WIDTH :: 32 - -@(private, rodata) -simd_scanner_indices := #simd[SIMD_SCAN_WIDTH]u8 { - 0, 1, 2, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, +@private SIMD_SCAN_WIDTH :: 8 * size_of(uintptr) + +when SIMD_SCAN_WIDTH == 32 { + @(private, rodata) + simd_scanner_indices := #simd[SIMD_SCAN_WIDTH]u8 { + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + } +} else when SIMD_SCAN_WIDTH == 64 { + @(private, rodata) + simd_scanner_indices := #simd[SIMD_SCAN_WIDTH]u8 { + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, + } +} else { + #panic("Invalid SIMD_SCAN_WIDTH. Must be 32 or 64.") } |