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
429 diff=(int32_t)(sourceLimit-source); in _Bocu1FromUnicodeWithOffsets()
430 if(targetCapacity>diff) { in _Bocu1FromUnicodeWithOffsets()
431 targetCapacity=diff; in _Bocu1FromUnicodeWithOffsets()
443 diff=c-prev; in _Bocu1FromUnicodeWithOffsets()
444 if(DIFF_IS_SINGLE(diff)) { in _Bocu1FromUnicodeWithOffsets()
446 *target++=(uint8_t)PACK_SINGLE_DIFF(diff); in _Bocu1FromUnicodeWithOffsets()
508 diff=c-prev; in _Bocu1FromUnicodeWithOffsets()
510 if(DIFF_IS_SINGLE(diff)) { in _Bocu1FromUnicodeWithOffsets()
511 *target++=(uint8_t)PACK_SINGLE_DIFF(diff); in _Bocu1FromUnicodeWithOffsets()
518 } else if(DIFF_IS_DOUBLE(diff) && 2<=targetCapacity) { in _Bocu1FromUnicodeWithOffsets()
522 if(diff>=0) { in _Bocu1FromUnicodeWithOffsets()
523 diff-=BOCU1_REACH_POS_1+1; in _Bocu1FromUnicodeWithOffsets()
524 m=diff%BOCU1_TRAIL_COUNT; in _Bocu1FromUnicodeWithOffsets()
525 diff/=BOCU1_TRAIL_COUNT; in _Bocu1FromUnicodeWithOffsets()
526 diff+=BOCU1_START_POS_2; in _Bocu1FromUnicodeWithOffsets()
528 diff-=BOCU1_REACH_NEG_1; in _Bocu1FromUnicodeWithOffsets()
529 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in _Bocu1FromUnicodeWithOffsets()
530 diff+=BOCU1_START_NEG_2; in _Bocu1FromUnicodeWithOffsets()
532 *target++=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
541 diff=packDiff(diff); in _Bocu1FromUnicodeWithOffsets()
542 length=BOCU1_LENGTH_FROM_PACKED(diff); in _Bocu1FromUnicodeWithOffsets()
550 *target++=(uint8_t)(diff>>24); in _Bocu1FromUnicodeWithOffsets()
553 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicodeWithOffsets()
556 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicodeWithOffsets()
559 *target++=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
582 *charErrorBuffer++=(uint8_t)(diff>>16); in _Bocu1FromUnicodeWithOffsets()
584 *charErrorBuffer++=(uint8_t)(diff>>8); in _Bocu1FromUnicodeWithOffsets()
586 *charErrorBuffer=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
594 diff>>=8*length; /* length was reduced by targetCapacity */ in _Bocu1FromUnicodeWithOffsets()
598 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicodeWithOffsets()
601 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicodeWithOffsets()
604 *target++=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
649 int32_t prev, c, diff; in _Bocu1FromUnicode() local
673 diff=(int32_t)(sourceLimit-source); in _Bocu1FromUnicode()
674 if(targetCapacity>diff) { in _Bocu1FromUnicode()
675 targetCapacity=diff; in _Bocu1FromUnicode()
684 diff=c-prev; in _Bocu1FromUnicode()
685 if(DIFF_IS_SINGLE(diff)) { in _Bocu1FromUnicode()
687 *target++=(uint8_t)PACK_SINGLE_DIFF(diff); in _Bocu1FromUnicode()
742 diff=c-prev; in _Bocu1FromUnicode()
744 if(DIFF_IS_SINGLE(diff)) { in _Bocu1FromUnicode()
745 *target++=(uint8_t)PACK_SINGLE_DIFF(diff); in _Bocu1FromUnicode()
750 } else if(DIFF_IS_DOUBLE(diff) && 2<=targetCapacity) { in _Bocu1FromUnicode()
754 if(diff>=0) { in _Bocu1FromUnicode()
755 diff-=BOCU1_REACH_POS_1+1; in _Bocu1FromUnicode()
756 m=diff%BOCU1_TRAIL_COUNT; in _Bocu1FromUnicode()
757 diff/=BOCU1_TRAIL_COUNT; in _Bocu1FromUnicode()
758 diff+=BOCU1_START_POS_2; in _Bocu1FromUnicode()
760 diff-=BOCU1_REACH_NEG_1; in _Bocu1FromUnicode()
761 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in _Bocu1FromUnicode()
762 diff+=BOCU1_START_NEG_2; in _Bocu1FromUnicode()
764 *target++=(uint8_t)diff; in _Bocu1FromUnicode()
770 diff=packDiff(diff); in _Bocu1FromUnicode()
771 length=BOCU1_LENGTH_FROM_PACKED(diff); in _Bocu1FromUnicode()
779 *target++=(uint8_t)(diff>>24); in _Bocu1FromUnicode()
781 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicode()
783 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicode()
785 *target++=(uint8_t)diff; in _Bocu1FromUnicode()
806 *charErrorBuffer++=(uint8_t)(diff>>16); in _Bocu1FromUnicode()
808 *charErrorBuffer++=(uint8_t)(diff>>8); in _Bocu1FromUnicode()
810 *charErrorBuffer=(uint8_t)diff; in _Bocu1FromUnicode()
818 diff>>=8*length; /* length was reduced by targetCapacity */ in _Bocu1FromUnicode()
822 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicode()
824 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicode()
826 *target++=(uint8_t)diff; in _Bocu1FromUnicode()
865 int32_t diff, count; in decodeBocu1LeadByte() local
871 diff=((int32_t)b-BOCU1_START_POS_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_1+1; in decodeBocu1LeadByte()
875 … diff=((int32_t)b-BOCU1_START_POS_3)*BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_2+1; in decodeBocu1LeadByte()
879 diff=BOCU1_REACH_POS_3+1; in decodeBocu1LeadByte()
886 diff=((int32_t)b-BOCU1_START_NEG_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_1; in decodeBocu1LeadByte()
890 … diff=((int32_t)b-BOCU1_START_NEG_3)*BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_2; in decodeBocu1LeadByte()
894 diff=-BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_3; in decodeBocu1LeadByte()
900 return (diff<<2)|count; in decodeBocu1LeadByte()
945 int32_t prev, count, diff, c; in _Bocu1ToUnicodeWithOffsets() local
965 diff=cnv->mode; /* mode may be set to UCNV_SI by ucnv_bld.c but then toULength==0 */ in _Bocu1ToUnicodeWithOffsets()
966 count=diff&3; in _Bocu1ToUnicodeWithOffsets()
967 diff>>=2; in _Bocu1ToUnicodeWithOffsets()
984 diff=(int32_t)(sourceLimit-source); in _Bocu1ToUnicodeWithOffsets()
986 if(count>diff) { in _Bocu1ToUnicodeWithOffsets()
987 count=diff; in _Bocu1ToUnicodeWithOffsets()
1048 diff=((int32_t)c-BOCU1_START_POS_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_1+1; in _Bocu1ToUnicodeWithOffsets()
1050 diff=((int32_t)c-BOCU1_START_NEG_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_1; in _Bocu1ToUnicodeWithOffsets()
1056 if(c<0 || (uint32_t)(c=prev+diff+c)>0x10ffff) { in _Bocu1ToUnicodeWithOffsets()
1077 diff=decodeBocu1LeadByte(c); in _Bocu1ToUnicodeWithOffsets()
1078 count=diff&3; in _Bocu1ToUnicodeWithOffsets()
1079 diff>>=2; in _Bocu1ToUnicodeWithOffsets()
1095 diff+=c; in _Bocu1ToUnicodeWithOffsets()
1099 c=prev+diff; in _Bocu1ToUnicodeWithOffsets()
1141 cnv->mode=(diff<<2)|count; in _Bocu1ToUnicodeWithOffsets()
1167 int32_t prev, count, diff, c; in _Bocu1ToUnicode() local
1184 diff=cnv->mode; /* mode may be set to UCNV_SI by ucnv_bld.c but then toULength==0 */ in _Bocu1ToUnicode()
1185 count=diff&3; in _Bocu1ToUnicode()
1186 diff>>=2; in _Bocu1ToUnicode()
1199 diff=(int32_t)(sourceLimit-source); in _Bocu1ToUnicode()
1201 if(count>diff) { in _Bocu1ToUnicode()
1202 count=diff; in _Bocu1ToUnicode()
1255 diff=((int32_t)c-BOCU1_START_POS_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_1+1; in _Bocu1ToUnicode()
1257 diff=((int32_t)c-BOCU1_START_NEG_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_1; in _Bocu1ToUnicode()
1262 if(c<0 || (uint32_t)(c=prev+diff+c)>0x10ffff) { in _Bocu1ToUnicode()
1282 diff=decodeBocu1LeadByte(c); in _Bocu1ToUnicode()
1283 count=diff&3; in _Bocu1ToUnicode()
1284 diff>>=2; in _Bocu1ToUnicode()
1299 diff+=c; in _Bocu1ToUnicode()
1303 c=prev+diff; in _Bocu1ToUnicode()
1340 cnv->mode=(diff<<2)|count; in _Bocu1ToUnicode()