Skip to content

Commit

Permalink
use @[direct_array_access] and i32() for the first element of `rune…
Browse files Browse the repository at this point in the history
…_maps`
  • Loading branch information
spytheman committed Nov 5, 2024
1 parent a17cdc0 commit 5c8084d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions vlib/builtin/rune.v
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub fn (c rune) to_title() rune {
}

// `map_to` rune map mode: .to_upper/.to_lower/.to_title
@[direct_array_access]
fn (c rune) map_to(mode MapMode) rune {
mut start := 0
mut end := rune_maps.len / 5
Expand Down
2 changes: 1 addition & 1 deletion vlib/builtin/rune_map.v
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct RuneMap {
// The overhead for representing it as an array of structs was ~36KB in .c, while with the flat array of ints, it is ~12KB.
// Given that xz can compress it to ~2.2KB, it could be probably represented in an even more compact way...
const rune_maps = [
0x41, 0x5A, 0, 32, 0,
i32(0x41), 0x5A, 0, 32, 0,
0x61, 0x7A, -32, 0, -32,
0xB5, 0xB5, 743, 0, 743,
0xC0, 0xD6, 0, 32, 0,
Expand Down

0 comments on commit 5c8084d

Please sign in to comment.