private int bucketIndexFor ( final int value ) { if ( value < cutoff ) { return value / interval ; } int bucket = num_linear_buckets // Skip all linear buckets. // And find which bucket the rest (after `cutoff') should be in. // Reminder: the first exponential bucket ends at 2^exp_bucket_shift. + log2rounddown ( ( value - cutoff ) >> exp_bucket_shift ) ; if ( bucket >= buckets . length ) { return buckets . length - 1 ; } return bucket ; }
Finds the index of the bucket in which the given value should be .