comparison Implab/Formats/CharMap.cs @ 236:302ca905c19e v2

JsonReader optimizations
author cin
date Tue, 21 Nov 2017 14:57:58 +0300
parents 6fa235c5a760
children
comparison
equal deleted inserted replaced
235:b49969a7043c 236:302ca905c19e
23 public int Count { 23 public int Count {
24 get; private set; 24 get; private set;
25 } 25 }
26 26
27 public bool Contains(char symbol) { 27 public bool Contains(char symbol) {
28 return symbol >= m_min && symbol <= m_max && m_map[symbol-m_min] != AutomatonConst.UNCLASSIFIED_INPUT; 28 return symbol >= m_min && symbol <= m_max && m_map[symbol-m_min] != AutomatonConst.UnclassifiedInput;
29 } 29 }
30 30
31 public IEnumerable<char> GetSymbols(int cls) { 31 public IEnumerable<char> GetSymbols(int cls) {
32 for (var i = 0; i < m_map.Length; i++) 32 for (var i = 0; i < m_map.Length; i++)
33 if (m_map[i] == cls) 33 if (m_map[i] == cls)
34 yield return (char)(i + m_min); 34 yield return (char)(i + m_min);
35 } 35 }
36 36
37 [MethodImpl(MethodImplOptions.AggressiveInlining)] 37 [MethodImpl(MethodImplOptions.AggressiveInlining)]
38 public int Translate(char symbol) { 38 public int Translate(char symbol) {
39 return symbol >= m_min && symbol <= m_max ? m_map[symbol-m_min] : AutomatonConst.UNCLASSIFIED_INPUT; 39 return symbol >= m_min && symbol <= m_max ? m_map[symbol-m_min] : AutomatonConst.UnclassifiedInput;
40 } 40 }
41 } 41 }
42 } 42 }