• Home
  • Raw
  • Download

Lines Matching refs:trie

100     UCPTrie *trie = (UCPTrie *)uprv_malloc(sizeof(UCPTrie));  in ucptrie_openFromBinary()  local
101 if (trie == nullptr) { in ucptrie_openFromBinary()
105 uprv_memcpy(trie, &tempTrie, sizeof(tempTrie)); in ucptrie_openFromBinary()
107 trie->name = "fromSerialized"; in ucptrie_openFromBinary()
112 trie->index = p16; in ucptrie_openFromBinary()
113 p16 += trie->indexLength; in ucptrie_openFromBinary()
116 int32_t nullValueOffset = trie->dataNullOffset; in ucptrie_openFromBinary()
117 if (nullValueOffset >= trie->dataLength) { in ucptrie_openFromBinary()
118 nullValueOffset = trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET; in ucptrie_openFromBinary()
122 trie->data.ptr16 = p16; in ucptrie_openFromBinary()
123 trie->nullValue = trie->data.ptr16[nullValueOffset]; in ucptrie_openFromBinary()
126 trie->data.ptr32 = (const uint32_t *)p16; in ucptrie_openFromBinary()
127 trie->nullValue = trie->data.ptr32[nullValueOffset]; in ucptrie_openFromBinary()
130 trie->data.ptr8 = (const uint8_t *)p16; in ucptrie_openFromBinary()
131 trie->nullValue = trie->data.ptr8[nullValueOffset]; in ucptrie_openFromBinary()
142 return trie; in ucptrie_openFromBinary()
146 ucptrie_close(UCPTrie *trie) { in ucptrie_close() argument
147 uprv_free(trie); in ucptrie_close()
151 ucptrie_getType(const UCPTrie *trie) { in ucptrie_getType() argument
152 return (UCPTrieType)trie->type; in ucptrie_getType()
156 ucptrie_getValueWidth(const UCPTrie *trie) { in ucptrie_getValueWidth() argument
157 return (UCPTrieValueWidth)trie->valueWidth; in ucptrie_getValueWidth()
161 ucptrie_internalSmallIndex(const UCPTrie *trie, UChar32 c) { in ucptrie_internalSmallIndex() argument
163 if (trie->type == UCPTRIE_TYPE_FAST) { in ucptrie_internalSmallIndex()
164 U_ASSERT(0xffff < c && c < trie->highStart); in ucptrie_internalSmallIndex()
167 U_ASSERT((uint32_t)c < (uint32_t)trie->highStart && trie->highStart > UCPTRIE_SMALL_LIMIT); in ucptrie_internalSmallIndex()
170 int32_t i3Block = trie->index[ in ucptrie_internalSmallIndex()
171 (int32_t)trie->index[i1] + ((c >> UCPTRIE_SHIFT_2) & UCPTRIE_INDEX_2_MASK)]; in ucptrie_internalSmallIndex()
176 dataBlock = trie->index[i3Block + i3]; in ucptrie_internalSmallIndex()
181 dataBlock = ((int32_t)trie->index[i3Block++] << (2 + (2 * i3))) & 0x30000; in ucptrie_internalSmallIndex()
182 dataBlock |= trie->index[i3Block + i3]; in ucptrie_internalSmallIndex()
188 ucptrie_internalSmallU8Index(const UCPTrie *trie, int32_t lt1, uint8_t t2, uint8_t t3) { in ucptrie_internalSmallU8Index() argument
190 if (c >= trie->highStart) { in ucptrie_internalSmallU8Index()
192 return trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET; in ucptrie_internalSmallU8Index()
194 return ucptrie_internalSmallIndex(trie, c); in ucptrie_internalSmallU8Index()
198 ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c, in ucptrie_internalU8PrevIndex() argument
210 int32_t idx = _UCPTRIE_CP_INDEX(trie, 0xffff, c); in ucptrie_internalU8PrevIndex()
233 ucptrie_get(const UCPTrie *trie, UChar32 c) { in ucptrie_get() argument
239 UChar32 fastMax = trie->type == UCPTRIE_TYPE_FAST ? 0xffff : UCPTRIE_SMALL_MAX; in ucptrie_get()
240 dataIndex = _UCPTRIE_CP_INDEX(trie, fastMax, c); in ucptrie_get()
242 return getValue(trie->data, (UCPTrieValueWidth)trie->valueWidth, dataIndex); in ucptrie_get()
264 const UCPTrie *trie = reinterpret_cast<const UCPTrie *>(t); in getRange() local
265 UCPTrieValueWidth valueWidth = (UCPTrieValueWidth)trie->valueWidth; in getRange()
266 if (start >= trie->highStart) { in getRange()
268 int32_t di = trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET; in getRange()
269 uint32_t value = getValue(trie->data, valueWidth, di); in getRange()
276 uint32_t nullValue = trie->nullValue; in getRange()
278 const uint16_t *index = trie->index; in getRange()
290 if (c <= 0xffff && (trie->type == UCPTRIE_TYPE_FAST || c <= UCPTRIE_SMALL_MAX)) { in getRange()
293 i3BlockLength = trie->type == UCPTRIE_TYPE_FAST ? in getRange()
299 if (trie->type == UCPTRIE_TYPE_FAST) { in getRange()
300 U_ASSERT(0xffff < c && c < trie->highStart); in getRange()
303 U_ASSERT(c < trie->highStart && trie->highStart > UCPTRIE_SMALL_LIMIT); in getRange()
306 i3Block = trie->index[ in getRange()
307 (int32_t)trie->index[i1] + ((c >> UCPTRIE_SHIFT_2) & UCPTRIE_INDEX_2_MASK)]; in getRange()
315 if (i3Block == trie->index3NullOffset) { in getRange()
322 trieValue = trie->nullValue; in getRange()
327 prevBlock = trie->dataNullOffset; in getRange()
354 if (block == trie->dataNullOffset) { in getRange()
361 trieValue = trie->nullValue; in getRange()
369 uint32_t trieValue2 = getValue(trie->data, valueWidth, di); in getRange()
373 maybeFilterValue(trieValue2, trie->nullValue, nullValue, in getRange()
381 value = maybeFilterValue(trieValue2, trie->nullValue, nullValue, in getRange()
387 trieValue2 = getValue(trie->data, valueWidth, ++di); in getRange()
390 maybeFilterValue(trieValue2, trie->nullValue, nullValue, in getRange()
400 } while (c < trie->highStart); in getRange()
402 int32_t di = trie->dataLength - UCPTRIE_HIGH_VALUE_NEG_DATA_OFFSET; in getRange()
403 uint32_t highValue = getValue(trie->data, valueWidth, di); in getRange()
404 if (maybeFilterValue(highValue, trie->nullValue, nullValue, in getRange()
416 const void *trie, UChar32 start, in ucptrie_internalGetRange() argument
420 return getRange(trie, start, filter, context, pValue); in ucptrie_internalGetRange()
428 UChar32 end = getRange(trie, start, filter, context, pValue); in ucptrie_internalGetRange()
453 UChar32 end2 = getRange(trie, surrEnd + 1, filter, context, &value2); in ucptrie_internalGetRange()
461 ucptrie_getRange(const UCPTrie *trie, UChar32 start, in ucptrie_getRange() argument
464 return ucptrie_internalGetRange(getRange, trie, start, in ucptrie_getRange()
470 ucptrie_toBinary(const UCPTrie *trie, in ucptrie_toBinary() argument
477 UCPTrieType type = (UCPTrieType)trie->type; in ucptrie_toBinary()
478 UCPTrieValueWidth valueWidth = (UCPTrieValueWidth)trie->valueWidth; in ucptrie_toBinary()
487 int32_t length = (int32_t)sizeof(UCPTrieHeader) + trie->indexLength * 2; in ucptrie_toBinary()
490 length += trie->dataLength * 2; in ucptrie_toBinary()
493 length += trie->dataLength * 4; in ucptrie_toBinary()
496 length += trie->dataLength; in ucptrie_toBinary()
511 ((trie->dataLength & 0xf0000) >> 4) | in ucptrie_toBinary()
512 ((trie->dataNullOffset & 0xf0000) >> 8) | in ucptrie_toBinary()
513 (trie->type << 6) | in ucptrie_toBinary()
515 header->indexLength = (uint16_t)trie->indexLength; in ucptrie_toBinary()
516 header->dataLength = (uint16_t)trie->dataLength; in ucptrie_toBinary()
517 header->index3NullOffset = trie->index3NullOffset; in ucptrie_toBinary()
518 header->dataNullOffset = (uint16_t)trie->dataNullOffset; in ucptrie_toBinary()
519 header->shiftedHighStart = trie->highStart >> UCPTRIE_SHIFT_2; in ucptrie_toBinary()
522 uprv_memcpy(bytes, trie->index, trie->indexLength * 2); in ucptrie_toBinary()
523 bytes += trie->indexLength * 2; in ucptrie_toBinary()
527 uprv_memcpy(bytes, trie->data.ptr16, trie->dataLength * 2); in ucptrie_toBinary()
530 uprv_memcpy(bytes, trie->data.ptr32, trie->dataLength * 4); in ucptrie_toBinary()
533 uprv_memcpy(bytes, trie->data.ptr8, trie->dataLength); in ucptrie_toBinary()
545 long countNull(const UCPTrie *trie) { in countNull() argument
546 uint32_t nullValue=trie->nullValue; in countNull()
547 int32_t length=trie->dataLength; in countNull()
549 switch (trie->valueWidth) { in countNull()
552 if(trie->data.ptr16[i]==nullValue) { ++count; } in countNull()
557 if(trie->data.ptr32[i]==nullValue) { ++count; } in countNull()
562 if(trie->data.ptr8[i]==nullValue) { ++count; } in countNull()
573 ucptrie_printLengths(const UCPTrie *trie, const char *which) { in ucptrie_printLengths() argument
574 long indexLength=trie->indexLength; in ucptrie_printLengths()
575 long dataLength=(long)trie->dataLength; in ucptrie_printLengths()
577 dataLength*(trie->valueWidth==UCPTRIE_VALUE_BITS_16 ? 2 : in ucptrie_printLengths()
578 trie->valueWidth==UCPTRIE_VALUE_BITS_32 ? 4 : 1); in ucptrie_printLengths()
580 which, trie->name, indexLength, dataLength, countNull(trie), totalLength); in ucptrie_printLengths()