Lines Matching refs:block
53 * including the bad-UTF-8-data block is not a multiple of UTRIE2_DATA_BLOCK_LENGTH
54 * and map[block>>UTRIE2_SHIFT_2] (used in reference counting and compaction
58 * assumes that a single index-2 block is used for 0x400 code points
61 * Requires UTRIE2_SHIFT_1<=16. Otherwise one single index-2 block contains
74 /** The null index-2 block, following the gap in the index-2 table. */
81 * The null data block.
92 * Below, compaction uses a block length of 64 for 2-byte UTF-8.
141 newTrie->firstFreeBlock=0; /* no free block in the list */
147 * - the bad-UTF-8-data block
148 * - the null data block
167 /* reference counts for the bad-UTF-8-data block */
172 * Reference counts for the null data block: all blocks except for the ASCII blocks.
173 * Plus 1 so that we don't drop this block during compaction.
188 * set the remaining indexes in the BMP index-2 block
189 * to the null data block
203 /* set the indexes in the null index-2 block */
210 /* set the index-1 indexes for the linear index-2 block */
218 /* set the remaining index-1 indexes to the null index-2 block */
460 int32_t i2, block;
469 block=trie->index2[i2];
470 return (UBool)(block==trie->dataNullOffset);
517 /* get the first free block */
521 /* get a new block from the high end */
557 /* call when the block's reference counter reaches 0 */
559 releaseDataBlock(UNewTrie2 *trie, int32_t block) {
560 /* put this block at the front of the free-block chain */
561 trie->map[block>>UTRIE2_SHIFT_2]=-trie->firstFreeBlock;
562 trie->firstFreeBlock=block;
566 isWritableBlock(UNewTrie2 *trie, int32_t block) {
567 return (UBool)(block!=trie->dataNullOffset && 1==trie->map[block>>UTRIE2_SHIFT_2]);
571 setIndex2Entry(UNewTrie2 *trie, int32_t i2, int32_t block) {
573 ++trie->map[block>>UTRIE2_SHIFT_2]; /* increment first, in case block==oldBlock! */
578 trie->index2[i2]=block;
584 * @return -1 if no new data block available (out of memory in data array)
602 /* allocate a new data block */
619 int32_t block;
626 block=getDataBlock(trie, c, forLSCP);
627 if(block<0) {
632 trie->data[block+(c&UTRIE2_DATA_MASK)]=value;
662 writeBlock(uint32_t *block, uint32_t value) {
663 uint32_t *limit=block+UTRIE2_DATA_BLOCK_LENGTH;
664 while(block<limit) {
665 *block++=value;
674 fillBlock(uint32_t *block, UChar32 start, UChar32 limit,
678 pLimit=block+limit;
679 block+=start;
681 while(block<pLimit) {
682 *block++=value;
685 while(block<pLimit) {
686 if(*block==initialValue) {
687 *block=value;
689 ++block;
705 int32_t block, rest, repeatBlock;
728 /* set partial block at [start..following block boundary[ */
729 block=getDataBlock(newTrie, start, TRUE);
730 if(block<0) {
737 fillBlock(newTrie->data+block, start&UTRIE2_DATA_MASK, UTRIE2_DATA_BLOCK_LENGTH,
741 fillBlock(newTrie->data+block, start&UTRIE2_DATA_MASK, limit&UTRIE2_DATA_MASK,
747 /* number of positions in the last, partial block */
750 /* round down limit to a block boundary */
776 block=newTrie->index2[i2];
777 if(isWritableBlock(newTrie, block)) {
779 if(overwrite && block>=UNEWTRIE2_DATA_0800_OFFSET) {
782 * protected (ASCII-linear or 2-byte UTF-8) block:
787 /* !overwrite, or protected block: just write the values into this block */
788 fillBlock(newTrie->data+block,
792 } else if(newTrie->data[block]!=value && (overwrite || block==newTrie->dataNullOffset)) {
794 * Set the repeatBlock instead of the null block or previous repeat block:
796 * If !isWritableBlock() then all entries in the block have the same value
797 * because it's the null block or a range block (the repeatBlock from a previous
801 * The null block is the only non-writable block with the initialValue because
803 * the repeatBlock will be the null data block.)
805 * We set our repeatBlock if the desired value differs from the block's value,
807 * (which is the same as the block being the null block, see above).
829 /* set partial block at [last block boundary..limit[ */
830 block=getDataBlock(newTrie, start, TRUE);
831 if(block<0) {
836 fillBlock(newTrie->data+block, 0, rest, value, newTrie->initialValue, overwrite);
866 int32_t block;
871 for(block=0; block<=index2Length; ++block) {
872 if(equal_int32(idx+block, idx+otherBlock, UTRIE2_INDEX_2_BLOCK_LENGTH)) {
873 return block;
881 int32_t block;
886 for(block=0; block<=dataLength; block+=UTRIE2_DATA_GRANULARITY) {
887 if(equal_uint32(data+block, data+otherBlock, blockLength)) {
888 return block;
904 int32_t i1, i2, j, i2Block, prevI2Block, index2NullOffset, block, prevBlock, nullBlock;
928 /* the index-2 block is the same as the previous one, and filled with highValue */
934 /* this is the null index-2 block */
940 /* enumerate data blocks for one index-2 block */
942 block=trie->index2[i2Block+ --i2];
943 if(block==prevBlock) {
944 /* the block is the same as the previous one, and filled with highValue */
948 prevBlock=block;
949 if(block==nullBlock) {
950 /* this is the null data block */
957 value=data32[block+ --j];
997 * Start with a block length of 64 for 2-byte UTF-8,
1004 * start: index of first entry of current block
1005 * newStart: index where the current block is to be moved
1015 /* advance start to the next block */
1018 /* leave newStart with the previous block! */
1022 /* search for an identical block */
1026 /* found an identical block, set the other block's index value for the current block */
1032 /* advance start to the next block */
1035 /* leave newStart with the previous block! */
1039 /* see if the beginning of this block can be overlapped with the end of the previous block */
1040 /* look for maximum overlap (modulo granularity) with the previous, adjacent block */
1046 /* some overlap, or just move the whole block */
1106 * start: index of first entry of current block
1107 * newStart: index where the current block is to be moved
1111 /* search for an identical block */
1115 /* found an identical block, set the other block's index value for the current block */
1118 /* advance start to the next block */
1121 /* leave newStart with the previous block! */
1125 /* see if the beginning of this block can be overlapped with the end of the previous block */
1126 /* look for maximum overlap with the previous, adjacent block */
1132 /* some overlap, or just move the whole block */