Lines Matching +full:- +full:v
1 // SPDX-License-Identifier: BSD-3-Clause
16 * Base-2 logarithm log2(n)
18 * Y = (u) computes the base-2 logarithm of
22 * +------------------+-----------------+--------+--------+
24 * +----+-----+-------+----+----+-------+--------+--------+
26 * +----+-----+-------+----+----+-------+--------+--------+
28 * +------------------+-----------------+--------+--------+
61 uint64_t v; in base2_logarithm() local
71 /* Skipping for-loop */ in base2_logarithm()
75 /* byte of V, and shift them out to the left. Continue with the */ in base2_logarithm()
76 /* shifted V for as many bytes as it has. */ in base2_logarithm()
78 /* one-based index. */ in base2_logarithm()
79 /* Index into the number-of-leading-zeros lookup table. This lookup */ in base2_logarithm()
83 /* Left-shift out all the leading zeros in the high byte. */ in base2_logarithm()
84 v = (uint64_t)u << shift_factor; in base2_logarithm()
85 /* Update the total number of left-shifts */ in base2_logarithm()
87 shift_factor = iv[v >> 24]; in base2_logarithm()
88 /* Left-shift out all the leading zeros in the high byte. */ in base2_logarithm()
89 v <<= shift_factor; in base2_logarithm()
90 /* Update the total number of left-shifts */ in base2_logarithm()
92 shift_factor = iv[v >> 24]; in base2_logarithm()
93 /* Left-shift out all the leading zeros in the high byte. */ in base2_logarithm()
94 v <<= shift_factor; in base2_logarithm()
95 /* Update the total number of left-shifts */ in base2_logarithm()
97 shift_factor = iv[v >> 24]; in base2_logarithm()
98 /* Left-shift out all the leading zeros in the high byte. */ in base2_logarithm()
99 /* Update the total number of left-shifts */ in base2_logarithm()
101 /* The input has been left-shifted so the most-significant-bit is a 1. */ in base2_logarithm()
104 x = (uint32_t)v << shift_factor; in base2_logarithm()
105 /* Let Q = int(u). Then u = Q*2^(-u_fraction_length), */ in base2_logarithm()
106 /* and x = Q*2^num_left_shifts * 2^(1-word_length). Therefore, */ in base2_logarithm()
110 slice_temp = (v << shift_factor) >> 24; in base2_logarithm()
114 a_i = BASE2LOG_WORDLENGTH - num_left_shifts; in base2_logarithm()
116 l1_i = iv1[(BASE2LOG_WRAP_SCHAR_BITS & ((x >> 24) + 129)) - 1]; in base2_logarithm()
118 l2_i = iv1[(BASE2LOG_WRAP_SCHAR_BITS & (slice_temp + 130)) - 1]; in base2_logarithm()
119 l3_i = iv1[(slice_temp - 127) - 1]; in base2_logarithm()
120 return s_v + (((x & BASE2LOG_UPPERBYTES) * (int64_t)(l2_i - l3_i)) >> 24); in base2_logarithm()