Zig 0.17.0-dev (Split by item)

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 library itself.

upcaseW

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.

nls.upcaseW
pub fn upcaseW(c: u16) u16

File

Code

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;
}