Function upcaseW [src]

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.

Prototype

pub fn upcaseW(c: u16) u16

Parameters

c: u16

Source

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