• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/ICU-511.35/icuSources/i18n/

Lines Matching refs:ranges

134 /* for uprv_sortArray: sort ranges in weight order */
152 * possible ranges of weights between the two limits, excluding them
153 * for weights with up to 4 bytes there are up to 2*4-1=7 ranges
158 WeightRange ranges[7]) {
198 * With the limit lengths of 1..4, there are up to 7 ranges for allocation:
208 * We are now going to calculate up to 7 ranges.
209 * Some of them will typically overlap, so we will then have to merge and eliminate ranges.
248 /* reduce or remove the lower ranges that go beyond upperLimit */
255 /* lower and upper ranges collide or are directly adjacent: merge these two and remove all shorter ranges */
259 * merging directly adjacent ranges needs to subtract the 0/1 gaps in between;
276 /* print ranges */
292 /* copy the ranges, shortest first, into the result array */
295 uprv_memcpy(ranges, &middle, sizeof(WeightRange));
301 uprv_memcpy(ranges+rangeCount, upper+length, sizeof(WeightRange));
305 uprv_memcpy(ranges+rangeCount, lower+length, sizeof(WeightRange));
314 * which ranges to use for a given number of weights between (excluding)
321 WeightRange ranges[7]) {
342 rangeCount=getWeightRanges(lowerLimit, upperLimit, maxByte, countBytes, ranges);
345 printf("error: unable to get Weight ranges\n");
350 /* what is the maximum number of weights with these ranges? */
353 maxCount+=(uint32_t)ranges[i].count*powers[4-ranges[i].length];
368 ranges[i].length2=ranges[i].length;
369 ranges[i].count2=(uint32_t)ranges[i].count;
372 /* try until we find suitably large ranges */
375 minLength=ranges[0].length2;
377 /* sum up the number of elements that fit into ranges of each byte length */
380 lengthCounts[ranges[i].length2]+=ranges[i].count2;
383 /* now try to allocate n elements in the available short ranges */
385 /* trivial cases, use the first few ranges */
389 maxCount+=ranges[rangeCount].count2;
393 printf("take first %ld ranges\n", rangeCount);
396 } else if(n<=ranges[0].count2*countBytes) {
403 power_1=powers[minLength-ranges[0].length];
406 count1=ranges[0].count-count2;
416 lengthenRange(ranges, maxByte, countBytes);
423 ranges[1].end=ranges[0].end;
424 ranges[1].length=ranges[0].length;
425 ranges[1].length2=minLength;
428 i=ranges[0].length;
429 byte=getWeightByte(ranges[0].start, i)+count1-1;
432 * ranges[0].count and count1 may be >countBytes
433 * from merging adjacent ranges;
437 ranges[0].end=setWeightByte(ranges[0].start, i, byte);
439 ranges[0].end=setWeightByte(incWeight(ranges[0].start, i-1, maxByte), i, byte-countBytes);
444 ranges[0].end=truncateWeight(ranges[0].end, i)|
448 ranges[1].start=incWeight(ranges[0].end, minLength, maxByte);
451 ranges[0].count=count1;
452 ranges[1].count=count2;
454 ranges[0].count2=count1*power_1;
455 ranges[1].count2=count2*power_1; /* will be *countBytes when lengthened */
458 lengthenRange(ranges+1, maxByte, countBytes);
463 /* no good match, lengthen all minLength ranges and iterate */
465 printf("lengthen the short ranges from %ld bytes to %ld and iterate\n", minLength, minLength+1);
467 for(i=0; ranges[i].length2==minLength; ++i) {
468 lengthenRange(ranges+i, maxByte, countBytes);
473 /* sort the ranges by weight values */
475 uprv_sortArray(ranges, rangeCount, sizeof(WeightRange), compareRanges, NULL, FALSE, &errorCode);
480 puts("final ranges:");
482 printf("ranges[%ld] .start=0x%08lx .end=0x%08lx .length=%ld .length2=%ld .count=%ld .count2=%lu\n",
483 i, ranges[i].start, ranges[i].end, ranges[i].length, ranges[i].length2, ranges[i].count, ranges[i].count2);
487 /* set maxByte in ranges[0] for ucol_nextWeight() */
488 ranges[0].count=maxByte;
494 * given a set of ranges calculated by ucol_allocWeights(),
498 ucol_nextWeight(WeightRange ranges[], int32_t *pRangeCount) {
505 maxByte=ranges[0].count;
508 weight=ranges[0].start;
509 if(weight==ranges[0].end) {
512 uprv_memmove(ranges, ranges+1, *pRangeCount*sizeof(WeightRange));
513 ranges[0].count=maxByte; /* keep maxByte in ranges[0] */
517 ranges[0].start=incWeight(weight, ranges[0].length2, maxByte);
528 WeightRange ranges[8];
531 rangeCount=ucol_allocWeights(lowerLimit, upperLimit, n, ranges);
536 weight=ucol_nextWeight(ranges, &rangeCount);