unicode

Branch: main

Switch branches or tags

Branch: main
Go to file t

413 files indexed

History
Code

ucd/regional_indicator/regional_indicator.mbt
1///|2/// Regional_Indicator lookup data3/// Generated from PropList.txt45///|6/// Regional_Indicator trie top level: `cp >> 10` to mid block index7let regional_indicator_trie_top : Bytes = [8  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,9  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,10  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,11  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,12  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,14  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,15  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,16  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,17  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,18]1920///|21/// Regional_Indicator trie mid level: leaf block indices22let regional_indicator_trie_mid : Bytes = [23  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,24]2526///|27/// Regional_Indicator trie leaf level: bitsets of 128 code points, least significant bit first28let regional_indicator_trie_leaf : Bytes = [29  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,30  0, 192, 255, 255, 255,31]3233///|34/// Check whether a character has the Unicode Regional_Indicator property35pub fn is_regional_indicator(c : Char) -> Bool {36  let cp = c.to_int()37  if cp >= 0x40000 {38    return false39  }40  let mid = (regional_indicator_trie_top[cp >> 10].to_int() << 3) |41    ((cp >> 7) & 7)42  let leaf = regional_indicator_trie_mid[mid].to_int()43  let bits = regional_indicator_trie_leaf[(leaf << 4) | ((cp >> 3) & 15)].to_int()44  ((bits >> (cp & 7)) & 1) != 045}46