Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

upcaseW

Public Function
std.os.windows.nls.upcaseW
pub fn upcaseW(c: u16) u16

Cross-platform implementation of ntdll.RtlUpcaseUnicodeChar. Transforms the UTF-16 code unit in c to its uppercased version if there is one. Otherwise, returns c unmodified.

Note: When this function is referenced, it will need to include uppercase_table.len * 2 bytes of data in the resulting binary since it depends on the uppercase_table data. When targeting Windows, ntdll.RtlUpcaseUnicodeChar can be used instead to avoid having to include a copy of this data.

Params

  • c: u16

File

os/windows/nls.zig:133
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
pub fn upcaseW(c: u16) u16 {
    if (c < 'a') {
        return c;
    }
    if (c <= 'z') {
        return c - ('a' - 'A');
    }
    if (c >= 0xC0) {
        var offset: u16 = 0;

        offset += @as(u8, @truncate(c >> 8));
        offset = uppercase_table[offset];
        offset += @as(u4, @truncate(c >> 4));
        offset = uppercase_table[offset];
        offset += @as(u4, @truncate(c));
        offset = uppercase_table[offset];

        return c +% offset;
    }
    return c;
}