Lines Matching full:ranges
194 /* for uprv_sortArray: sort ranges in weight order */
250 * With the limit lengths of 1..4, there are up to 7 ranges for allocation: in getWeightRanges()
260 * We are now going to calculate up to 7 ranges. in getWeightRanges()
261 * Some of them will typically overlap, so we will then have to merge and eliminate ranges. in getWeightRanges()
313 // These two lower and upper ranges collide. in getWeightRanges()
322 // Intersect these two ranges. in getWeightRanges()
335 // Merge adjacent ranges. in getWeightRanges()
342 // Remove all shorter ranges. in getWeightRanges()
343 // There was no room available for them between the ranges we just merged. in getWeightRanges()
355 /* print ranges */ in getWeightRanges()
371 /* copy the ranges, shortest first, into the result array */ in getWeightRanges()
374 uprv_memcpy(ranges, &middle, sizeof(WeightRange)); in getWeightRanges()
380 uprv_memcpy(ranges+rangeCount, upper+length, sizeof(WeightRange)); in getWeightRanges()
384 uprv_memcpy(ranges+rangeCount, lower+length, sizeof(WeightRange)); in getWeightRanges()
393 // See if the first few minLength and minLength+1 ranges have enough weights. in allocWeightsInShortRanges()
394 for(int32_t i = 0; i < rangeCount && ranges[i].length <= (minLength + 1); ++i) { in allocWeightsInShortRanges()
395 if(n <= ranges[i].count) { in allocWeightsInShortRanges()
396 // Use the first few minLength and minLength+1 ranges. in allocWeightsInShortRanges()
397 if(ranges[i].length > minLength) { in allocWeightsInShortRanges()
399 // which might sort before some minLength ranges, in allocWeightsInShortRanges()
400 // so that we use all weights in the minLength ranges. in allocWeightsInShortRanges()
401 ranges[i].count = n; in allocWeightsInShortRanges()
405 printf("take first %ld ranges\n", rangeCount); in allocWeightsInShortRanges()
409 /* sort the ranges by weight values */ in allocWeightsInShortRanges()
411 uprv_sortArray(ranges, rangeCount, sizeof(WeightRange), in allocWeightsInShortRanges()
417 n -= ranges[i].count; // still >0 in allocWeightsInShortRanges()
424 // See if the minLength ranges have enough weights in allocWeightsInMinLengthRanges()
430 ranges[minLengthRangeCount].length == minLength; in allocWeightsInMinLengthRanges()
432 count += ranges[minLengthRangeCount].count; in allocWeightsInMinLengthRanges()
438 // Use the minLength ranges. Merge them, and then split again as necessary. in allocWeightsInMinLengthRanges()
439 uint32_t start = ranges[0].start; in allocWeightsInMinLengthRanges()
440 uint32_t end = ranges[0].end; in allocWeightsInMinLengthRanges()
442 if(ranges[i].start < start) { start = ranges[i].start; } in allocWeightsInMinLengthRanges()
443 if(ranges[i].end > end) { end = ranges[i].end; } in allocWeightsInMinLengthRanges()
462 ranges[0].start = start; in allocWeightsInMinLengthRanges()
466 ranges[0].end = end; in allocWeightsInMinLengthRanges()
467 ranges[0].count = count; in allocWeightsInMinLengthRanges()
468 lengthenRange(ranges[0]); in allocWeightsInMinLengthRanges()
473 printf("split the range number %ld (out of %ld minLength ranges) by %ld:%ld\n", in allocWeightsInMinLengthRanges()
478 ranges[0].end = incWeightByOffset(start, minLength, count1 - 1); in allocWeightsInMinLengthRanges()
479 ranges[0].count = count1; in allocWeightsInMinLengthRanges()
481 ranges[1].start = incWeight(ranges[0].end, minLength); in allocWeightsInMinLengthRanges()
482 ranges[1].end = end; in allocWeightsInMinLengthRanges()
483 ranges[1].length = minLength; // +1 when lengthened in allocWeightsInMinLengthRanges()
484 ranges[1].count = count2; // *countBytes when lengthened in allocWeightsInMinLengthRanges()
485 lengthenRange(ranges[1]); in allocWeightsInMinLengthRanges()
493 * which ranges to use for a given number of weights between (excluding)
504 printf("error: unable to get Weight ranges\n"); in allocWeights()
509 /* try until we find suitably large ranges */ in allocWeights()
512 int32_t minLength=ranges[0].length; in allocWeights()
526 /* no good match, lengthen all minLength ranges and iterate */ in allocWeights()
528 … printf("lengthen the short ranges from %ld bytes to %ld and iterate\n", minLength, minLength+1); in allocWeights()
530 for(int32_t i=0; i<rangeCount && ranges[i].length==minLength; ++i) { in allocWeights()
531 lengthenRange(ranges[i]); in allocWeights()
536 puts("final ranges:"); in allocWeights()
538 printf("ranges[%ld] .start=0x%08lx .end=0x%08lx .length=%ld .count=%ld\n", in allocWeights()
539 i, ranges[i].start, ranges[i].end, ranges[i].length, ranges[i].count); in allocWeights()
553 WeightRange &range = ranges[rangeIndex]; in nextWeight()