Lines Matching refs:diff

215 #define DIFF_IS_SINGLE(diff) (BOCU1_REACH_NEG_1<=(diff) && (diff)<=BOCU1_REACH_POS_1)  argument
218 #define PACK_SINGLE_DIFF(diff) (BOCU1_MIDDLE+(diff)) argument
221 #define DIFF_IS_DOUBLE(diff) (BOCU1_REACH_NEG_2<=(diff) && (diff)<=BOCU1_REACH_POS_2) argument
285 packDiff(int32_t diff) { in packDiff() argument
288 … U_ASSERT(!DIFF_IS_SINGLE(diff)); /* assume we won't be called where diff==BOCU1_REACH_NEG_1=-64 */ in packDiff()
289 if(diff>=BOCU1_REACH_NEG_1) { in packDiff()
292 if(diff<=BOCU1_REACH_POS_1) { in packDiff()
294 return 0x01000000|(BOCU1_MIDDLE+diff); in packDiff()
297 if(diff<=BOCU1_REACH_POS_2) { in packDiff()
299 diff-=BOCU1_REACH_POS_1+1; in packDiff()
302 m=diff%BOCU1_TRAIL_COUNT; in packDiff()
303 diff/=BOCU1_TRAIL_COUNT; in packDiff()
306 result|=(BOCU1_START_POS_2+diff)<<8; in packDiff()
307 } else if(diff<=BOCU1_REACH_POS_3) { in packDiff()
309 diff-=BOCU1_REACH_POS_2+1; in packDiff()
312 m=diff%BOCU1_TRAIL_COUNT; in packDiff()
313 diff/=BOCU1_TRAIL_COUNT; in packDiff()
316 m=diff%BOCU1_TRAIL_COUNT; in packDiff()
317 diff/=BOCU1_TRAIL_COUNT; in packDiff()
320 result|=(BOCU1_START_POS_3+diff)<<16; in packDiff()
323 diff-=BOCU1_REACH_POS_3+1; in packDiff()
325 m=diff%BOCU1_TRAIL_COUNT; in packDiff()
326 diff/=BOCU1_TRAIL_COUNT; in packDiff()
329 m=diff%BOCU1_TRAIL_COUNT; in packDiff()
330 diff/=BOCU1_TRAIL_COUNT; in packDiff()
337 result|=BOCU1_TRAIL_TO_BYTE(diff)<<16; in packDiff()
343 if(diff>=BOCU1_REACH_NEG_2) { in packDiff()
345 diff-=BOCU1_REACH_NEG_1; in packDiff()
348 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in packDiff()
351 result|=(BOCU1_START_NEG_2+diff)<<8; in packDiff()
352 } else if(diff>=BOCU1_REACH_NEG_3) { in packDiff()
354 diff-=BOCU1_REACH_NEG_2; in packDiff()
357 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in packDiff()
360 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in packDiff()
363 result|=(BOCU1_START_NEG_3+diff)<<16; in packDiff()
366 diff-=BOCU1_REACH_NEG_3; in packDiff()
368 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in packDiff()
371 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in packDiff()
379 m=diff+BOCU1_TRAIL_COUNT; in packDiff()
398 int32_t prev, c, diff; in _Bocu1FromUnicodeWithOffsets() local
431 diff=(int32_t)(sourceLimit-source); in _Bocu1FromUnicodeWithOffsets()
432 if(targetCapacity>diff) { in _Bocu1FromUnicodeWithOffsets()
433 targetCapacity=diff; in _Bocu1FromUnicodeWithOffsets()
445 diff=c-prev; in _Bocu1FromUnicodeWithOffsets()
446 if(DIFF_IS_SINGLE(diff)) { in _Bocu1FromUnicodeWithOffsets()
448 *target++=(uint8_t)PACK_SINGLE_DIFF(diff); in _Bocu1FromUnicodeWithOffsets()
510 diff=c-prev; in _Bocu1FromUnicodeWithOffsets()
512 if(DIFF_IS_SINGLE(diff)) { in _Bocu1FromUnicodeWithOffsets()
513 *target++=(uint8_t)PACK_SINGLE_DIFF(diff); in _Bocu1FromUnicodeWithOffsets()
520 } else if(DIFF_IS_DOUBLE(diff) && 2<=targetCapacity) { in _Bocu1FromUnicodeWithOffsets()
524 if(diff>=0) { in _Bocu1FromUnicodeWithOffsets()
525 diff-=BOCU1_REACH_POS_1+1; in _Bocu1FromUnicodeWithOffsets()
526 m=diff%BOCU1_TRAIL_COUNT; in _Bocu1FromUnicodeWithOffsets()
527 diff/=BOCU1_TRAIL_COUNT; in _Bocu1FromUnicodeWithOffsets()
528 diff+=BOCU1_START_POS_2; in _Bocu1FromUnicodeWithOffsets()
530 diff-=BOCU1_REACH_NEG_1; in _Bocu1FromUnicodeWithOffsets()
531 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in _Bocu1FromUnicodeWithOffsets()
532 diff+=BOCU1_START_NEG_2; in _Bocu1FromUnicodeWithOffsets()
534 *target++=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
543 diff=packDiff(diff); in _Bocu1FromUnicodeWithOffsets()
544 length=BOCU1_LENGTH_FROM_PACKED(diff); in _Bocu1FromUnicodeWithOffsets()
552 *target++=(uint8_t)(diff>>24); in _Bocu1FromUnicodeWithOffsets()
555 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicodeWithOffsets()
558 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicodeWithOffsets()
561 *target++=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
584 *charErrorBuffer++=(uint8_t)(diff>>16); in _Bocu1FromUnicodeWithOffsets()
586 *charErrorBuffer++=(uint8_t)(diff>>8); in _Bocu1FromUnicodeWithOffsets()
588 *charErrorBuffer=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
596 diff>>=8*length; /* length was reduced by targetCapacity */ in _Bocu1FromUnicodeWithOffsets()
600 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicodeWithOffsets()
603 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicodeWithOffsets()
606 *target++=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
651 int32_t prev, c, diff; in _Bocu1FromUnicode() local
675 diff=(int32_t)(sourceLimit-source); in _Bocu1FromUnicode()
676 if(targetCapacity>diff) { in _Bocu1FromUnicode()
677 targetCapacity=diff; in _Bocu1FromUnicode()
686 diff=c-prev; in _Bocu1FromUnicode()
687 if(DIFF_IS_SINGLE(diff)) { in _Bocu1FromUnicode()
689 *target++=(uint8_t)PACK_SINGLE_DIFF(diff); in _Bocu1FromUnicode()
744 diff=c-prev; in _Bocu1FromUnicode()
746 if(DIFF_IS_SINGLE(diff)) { in _Bocu1FromUnicode()
747 *target++=(uint8_t)PACK_SINGLE_DIFF(diff); in _Bocu1FromUnicode()
752 } else if(DIFF_IS_DOUBLE(diff) && 2<=targetCapacity) { in _Bocu1FromUnicode()
756 if(diff>=0) { in _Bocu1FromUnicode()
757 diff-=BOCU1_REACH_POS_1+1; in _Bocu1FromUnicode()
758 m=diff%BOCU1_TRAIL_COUNT; in _Bocu1FromUnicode()
759 diff/=BOCU1_TRAIL_COUNT; in _Bocu1FromUnicode()
760 diff+=BOCU1_START_POS_2; in _Bocu1FromUnicode()
762 diff-=BOCU1_REACH_NEG_1; in _Bocu1FromUnicode()
763 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in _Bocu1FromUnicode()
764 diff+=BOCU1_START_NEG_2; in _Bocu1FromUnicode()
766 *target++=(uint8_t)diff; in _Bocu1FromUnicode()
772 diff=packDiff(diff); in _Bocu1FromUnicode()
773 length=BOCU1_LENGTH_FROM_PACKED(diff); in _Bocu1FromUnicode()
781 *target++=(uint8_t)(diff>>24); in _Bocu1FromUnicode()
783 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicode()
785 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicode()
787 *target++=(uint8_t)diff; in _Bocu1FromUnicode()
808 *charErrorBuffer++=(uint8_t)(diff>>16); in _Bocu1FromUnicode()
810 *charErrorBuffer++=(uint8_t)(diff>>8); in _Bocu1FromUnicode()
812 *charErrorBuffer=(uint8_t)diff; in _Bocu1FromUnicode()
820 diff>>=8*length; /* length was reduced by targetCapacity */ in _Bocu1FromUnicode()
824 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicode()
826 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicode()
828 *target++=(uint8_t)diff; in _Bocu1FromUnicode()
867 int32_t diff, count; in decodeBocu1LeadByte() local
873 diff=((int32_t)b-BOCU1_START_POS_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_1+1; in decodeBocu1LeadByte()
877diff=((int32_t)b-BOCU1_START_POS_3)*BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_2+1; in decodeBocu1LeadByte()
881 diff=BOCU1_REACH_POS_3+1; in decodeBocu1LeadByte()
888 diff=((int32_t)b-BOCU1_START_NEG_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_1; in decodeBocu1LeadByte()
892diff=((int32_t)b-BOCU1_START_NEG_3)*BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_2; in decodeBocu1LeadByte()
896 diff=-BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_3; in decodeBocu1LeadByte()
902 return (diff<<2)|count; in decodeBocu1LeadByte()
947 int32_t prev, count, diff, c; in _Bocu1ToUnicodeWithOffsets() local
967 diff=cnv->mode; /* mode may be set to UCNV_SI by ucnv_bld.c but then toULength==0 */ in _Bocu1ToUnicodeWithOffsets()
968 count=diff&3; in _Bocu1ToUnicodeWithOffsets()
969 diff>>=2; in _Bocu1ToUnicodeWithOffsets()
986 diff=(int32_t)(sourceLimit-source); in _Bocu1ToUnicodeWithOffsets()
988 if(count>diff) { in _Bocu1ToUnicodeWithOffsets()
989 count=diff; in _Bocu1ToUnicodeWithOffsets()
1050 diff=((int32_t)c-BOCU1_START_POS_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_1+1; in _Bocu1ToUnicodeWithOffsets()
1052 diff=((int32_t)c-BOCU1_START_NEG_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_1; in _Bocu1ToUnicodeWithOffsets()
1058 if(c<0 || (uint32_t)(c=prev+diff+c)>0x10ffff) { in _Bocu1ToUnicodeWithOffsets()
1079 diff=decodeBocu1LeadByte(c); in _Bocu1ToUnicodeWithOffsets()
1080 count=diff&3; in _Bocu1ToUnicodeWithOffsets()
1081 diff>>=2; in _Bocu1ToUnicodeWithOffsets()
1097 diff+=c; in _Bocu1ToUnicodeWithOffsets()
1101 c=prev+diff; in _Bocu1ToUnicodeWithOffsets()
1143 cnv->mode=(diff<<2)|count; in _Bocu1ToUnicodeWithOffsets()
1169 int32_t prev, count, diff, c; in _Bocu1ToUnicode() local
1188 diff=cnv->mode; /* mode may be set to UCNV_SI by ucnv_bld.c but then toULength==0 */ in _Bocu1ToUnicode()
1189 count=diff&3; in _Bocu1ToUnicode()
1190 diff>>=2; in _Bocu1ToUnicode()
1203 diff=(int32_t)(sourceLimit-source); in _Bocu1ToUnicode()
1205 if(count>diff) { in _Bocu1ToUnicode()
1206 count=diff; in _Bocu1ToUnicode()
1259 diff=((int32_t)c-BOCU1_START_POS_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_1+1; in _Bocu1ToUnicode()
1261 diff=((int32_t)c-BOCU1_START_NEG_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_1; in _Bocu1ToUnicode()
1266 if(c<0 || (uint32_t)(c=prev+diff+c)>0x10ffff) { in _Bocu1ToUnicode()
1286 diff=decodeBocu1LeadByte(c); in _Bocu1ToUnicode()
1287 count=diff&3; in _Bocu1ToUnicode()
1288 diff>>=2; in _Bocu1ToUnicode()
1303 diff+=c; in _Bocu1ToUnicode()
1307 c=prev+diff; in _Bocu1ToUnicode()
1344 cnv->mode=(diff<<2)|count; in _Bocu1ToUnicode()