• Home
  • Raw
  • Download

Lines Matching full:diff

214 /* Faster versions of packDiff() for single-byte-encoded diff values. */
216 /** Is a diff value encodable in a single byte? */
217 #define DIFF_IS_SINGLE(diff) (BOCU1_REACH_NEG_1<=(diff) && (diff)<=BOCU1_REACH_POS_1) argument
219 /** Encode a diff value in a single byte. */
220 #define PACK_SINGLE_DIFF(diff) (BOCU1_MIDDLE+(diff)) argument
222 /** Is a diff value encodable in two bytes? */
223 #define DIFF_IS_DOUBLE(diff) (BOCU1_REACH_NEG_2<=(diff) && (diff)<=BOCU1_REACH_POS_2) argument
264 * mode decoder's incomplete (diff<<2)|count (ignored when toULength==0)
279 * @param diff difference value -0x10ffff..0x10ffff
287 packDiff(int32_t diff) { in packDiff() argument
290 … U_ASSERT(!DIFF_IS_SINGLE(diff)); /* assume we won't be called where diff==BOCU1_REACH_NEG_1=-64 */ in packDiff()
291 if(diff>=BOCU1_REACH_NEG_1) { in packDiff()
294 if(diff<=BOCU1_REACH_POS_1) { in packDiff()
296 return 0x01000000|(BOCU1_MIDDLE+diff); in packDiff()
299 if(diff<=BOCU1_REACH_POS_2) { in packDiff()
301 diff-=BOCU1_REACH_POS_1+1; in packDiff()
304 m=diff%BOCU1_TRAIL_COUNT; in packDiff()
305 diff/=BOCU1_TRAIL_COUNT; in packDiff()
308 result|=(BOCU1_START_POS_2+diff)<<8; in packDiff()
309 } else if(diff<=BOCU1_REACH_POS_3) { in packDiff()
311 diff-=BOCU1_REACH_POS_2+1; in packDiff()
314 m=diff%BOCU1_TRAIL_COUNT; in packDiff()
315 diff/=BOCU1_TRAIL_COUNT; in packDiff()
318 m=diff%BOCU1_TRAIL_COUNT; in packDiff()
319 diff/=BOCU1_TRAIL_COUNT; in packDiff()
322 result|=(BOCU1_START_POS_3+diff)<<16; in packDiff()
325 diff-=BOCU1_REACH_POS_3+1; in packDiff()
327 m=diff%BOCU1_TRAIL_COUNT; in packDiff()
328 diff/=BOCU1_TRAIL_COUNT; in packDiff()
331 m=diff%BOCU1_TRAIL_COUNT; in packDiff()
332 diff/=BOCU1_TRAIL_COUNT; in packDiff()
336 * We know that / and % would deliver quotient 0 and rest=diff. in packDiff()
339 result|=BOCU1_TRAIL_TO_BYTE(diff)<<16; in packDiff()
345 if(diff>=BOCU1_REACH_NEG_2) { in packDiff()
347 diff-=BOCU1_REACH_NEG_1; in packDiff()
350 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in packDiff()
353 result|=(BOCU1_START_NEG_2+diff)<<8; in packDiff()
354 } else if(diff>=BOCU1_REACH_NEG_3) { in packDiff()
356 diff-=BOCU1_REACH_NEG_2; in packDiff()
359 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in packDiff()
362 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in packDiff()
365 result|=(BOCU1_START_NEG_3+diff)<<16; in packDiff()
368 diff-=BOCU1_REACH_NEG_3; in packDiff()
370 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in packDiff()
373 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in packDiff()
378 * quotient -1 and rest=diff+BOCU1_TRAIL_COUNT. in packDiff()
381 m=diff+BOCU1_TRAIL_COUNT; in packDiff()
400 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()
546 /* write the output character bytes from diff and length */ in _Bocu1FromUnicodeWithOffsets()
552 *target++=(uint8_t)(diff>>24); in _Bocu1FromUnicodeWithOffsets()
556 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicodeWithOffsets()
560 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicodeWithOffsets()
563 *target++=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
587 *charErrorBuffer++=(uint8_t)(diff>>16); in _Bocu1FromUnicodeWithOffsets()
590 *charErrorBuffer++=(uint8_t)(diff>>8); in _Bocu1FromUnicodeWithOffsets()
593 *charErrorBuffer=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
602 diff>>=8*length; /* length was reduced by targetCapacity */ in _Bocu1FromUnicodeWithOffsets()
606 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicodeWithOffsets()
610 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicodeWithOffsets()
614 *target++=(uint8_t)diff; in _Bocu1FromUnicodeWithOffsets()
660 int32_t prev, c, diff; in _Bocu1FromUnicode() local
684 diff=(int32_t)(sourceLimit-source); in _Bocu1FromUnicode()
685 if(targetCapacity>diff) { in _Bocu1FromUnicode()
686 targetCapacity=diff; in _Bocu1FromUnicode()
695 diff=c-prev; in _Bocu1FromUnicode()
696 if(DIFF_IS_SINGLE(diff)) { in _Bocu1FromUnicode()
698 *target++=(uint8_t)PACK_SINGLE_DIFF(diff); in _Bocu1FromUnicode()
753 diff=c-prev; in _Bocu1FromUnicode()
755 if(DIFF_IS_SINGLE(diff)) { in _Bocu1FromUnicode()
756 *target++=(uint8_t)PACK_SINGLE_DIFF(diff); in _Bocu1FromUnicode()
761 } else if(DIFF_IS_DOUBLE(diff) && 2<=targetCapacity) { in _Bocu1FromUnicode()
765 if(diff>=0) { in _Bocu1FromUnicode()
766 diff-=BOCU1_REACH_POS_1+1; in _Bocu1FromUnicode()
767 m=diff%BOCU1_TRAIL_COUNT; in _Bocu1FromUnicode()
768 diff/=BOCU1_TRAIL_COUNT; in _Bocu1FromUnicode()
769 diff+=BOCU1_START_POS_2; in _Bocu1FromUnicode()
771 diff-=BOCU1_REACH_NEG_1; in _Bocu1FromUnicode()
772 NEGDIVMOD(diff, BOCU1_TRAIL_COUNT, m); in _Bocu1FromUnicode()
773 diff+=BOCU1_START_NEG_2; in _Bocu1FromUnicode()
775 *target++=(uint8_t)diff; in _Bocu1FromUnicode()
781 diff=packDiff(diff); in _Bocu1FromUnicode()
782 length=BOCU1_LENGTH_FROM_PACKED(diff); in _Bocu1FromUnicode()
784 /* write the output character bytes from diff and length */ in _Bocu1FromUnicode()
790 *target++=(uint8_t)(diff>>24); in _Bocu1FromUnicode()
793 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicode()
795 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicode()
797 *target++=(uint8_t)diff; in _Bocu1FromUnicode()
819 *charErrorBuffer++=(uint8_t)(diff>>16); in _Bocu1FromUnicode()
822 *charErrorBuffer++=(uint8_t)(diff>>8); in _Bocu1FromUnicode()
825 *charErrorBuffer=(uint8_t)diff; in _Bocu1FromUnicode()
834 diff>>=8*length; /* length was reduced by targetCapacity */ in _Bocu1FromUnicode()
838 *target++=(uint8_t)(diff>>16); in _Bocu1FromUnicode()
841 *target++=(uint8_t)(diff>>8); in _Bocu1FromUnicode()
844 *target++=(uint8_t)diff; in _Bocu1FromUnicode()
880 * @return (diff<<2)|count
884 int32_t diff, count; in decodeBocu1LeadByte() local
890 diff=((int32_t)b-BOCU1_START_POS_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_1+1; in decodeBocu1LeadByte()
894diff=((int32_t)b-BOCU1_START_POS_3)*BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_2+1; in decodeBocu1LeadByte()
898 diff=BOCU1_REACH_POS_3+1; in decodeBocu1LeadByte()
905 diff=((int32_t)b-BOCU1_START_NEG_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_1; in decodeBocu1LeadByte()
909diff=((int32_t)b-BOCU1_START_NEG_3)*BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_2; in decodeBocu1LeadByte()
913 diff=-BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_3; in decodeBocu1LeadByte()
919 return (diff<<2)|count; in decodeBocu1LeadByte()
927 * @return new delta for diff including b - <0 indicates an error
964 int32_t prev, count, diff, c; in _Bocu1ToUnicodeWithOffsets() local
984 diff=cnv->mode; /* mode may be set to UCNV_SI by ucnv_bld.c but then toULength==0 */ in _Bocu1ToUnicodeWithOffsets()
985 count=diff&3; in _Bocu1ToUnicodeWithOffsets()
986 diff>>=2; in _Bocu1ToUnicodeWithOffsets()
1003 diff=(int32_t)(sourceLimit-source); in _Bocu1ToUnicodeWithOffsets()
1005 if(count>diff) { in _Bocu1ToUnicodeWithOffsets()
1006 count=diff; in _Bocu1ToUnicodeWithOffsets()
1067 diff=((int32_t)c-BOCU1_START_POS_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_1+1; in _Bocu1ToUnicodeWithOffsets()
1069 diff=((int32_t)c-BOCU1_START_NEG_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_1; in _Bocu1ToUnicodeWithOffsets()
1075 if(c<0 || (uint32_t)(c=prev+diff+c)>0x10ffff) { in _Bocu1ToUnicodeWithOffsets()
1096 diff=decodeBocu1LeadByte(c); in _Bocu1ToUnicodeWithOffsets()
1097 count=diff&3; in _Bocu1ToUnicodeWithOffsets()
1098 diff>>=2; in _Bocu1ToUnicodeWithOffsets()
1114 diff+=c; in _Bocu1ToUnicodeWithOffsets()
1118 c=prev+diff; in _Bocu1ToUnicodeWithOffsets()
1160 cnv->mode=(diff<<2)|count; in _Bocu1ToUnicodeWithOffsets()
1186 int32_t prev, count, diff, c; in _Bocu1ToUnicode() local
1203 diff=cnv->mode; /* mode may be set to UCNV_SI by ucnv_bld.c but then toULength==0 */ in _Bocu1ToUnicode()
1204 count=diff&3; in _Bocu1ToUnicode()
1205 diff>>=2; in _Bocu1ToUnicode()
1218 diff=(int32_t)(sourceLimit-source); in _Bocu1ToUnicode()
1220 if(count>diff) { in _Bocu1ToUnicode()
1221 count=diff; in _Bocu1ToUnicode()
1274 diff=((int32_t)c-BOCU1_START_POS_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_POS_1+1; in _Bocu1ToUnicode()
1276 diff=((int32_t)c-BOCU1_START_NEG_2)*BOCU1_TRAIL_COUNT+BOCU1_REACH_NEG_1; in _Bocu1ToUnicode()
1281 if(c<0 || (uint32_t)(c=prev+diff+c)>0x10ffff) { in _Bocu1ToUnicode()
1301 diff=decodeBocu1LeadByte(c); in _Bocu1ToUnicode()
1302 count=diff&3; in _Bocu1ToUnicode()
1303 diff>>=2; in _Bocu1ToUnicode()
1318 diff+=c; in _Bocu1ToUnicode()
1322 c=prev+diff; in _Bocu1ToUnicode()
1359 cnv->mode=(diff<<2)|count; in _Bocu1ToUnicode()