• Home
  • Raw
  • Download

Lines Matching +full:j +full:- +full:to +full:- +full:k

1 // SPDX-License-Identifier: GPL-2.0-only
5 * produce the same thing and, for cases where a k-bit hash
8 * We fill a buffer with a 255-byte null-terminated string,
9 * and use both full_name_hash() and hashlen_string() to hash the
10 * substrings from i to j, where 0 <= i < j < 256.
12 * The returned values are used to check that __hash_32() and
26 /* 32-bit XORSHIFT generator. Seed must not be zero. */
36 /* Given a non-zero x, returns a non-zero byte. */
47 /* Fill the buffer with non-zero bytes. */
60 * Test the various integer hash functions. h64 (or its low-order bits)
61 * is the integer to hash. hash_or accumulates the OR of the hash values,
62 * which are later checked to see that they cover all the requested bits.
64 * Because these functions (as opposed to the string hashes) are all
66 * recompile and re-test the module without rebooting.
71 int k; in test_int_hash() local
87 /* Test k = 1..32 bits */ in test_int_hash()
88 for (k = 1; k <= 32; k++) { in test_int_hash()
89 u32 const m = ((u32)2 << (k-1)) - 1; /* Low k bits set */ in test_int_hash()
92 hash_or[0][k] |= h1 = hash_32(h0, k); in test_int_hash()
94 pr_err("hash_32(%#x, %d) = %#x > %#x", h0, k, h1, m); in test_int_hash()
98 h2 = hash_32_generic(h0, k); in test_int_hash()
102 " = %#x", h0, k, h1, h2); in test_int_hash()
108 h0, k, h1, m); in test_int_hash()
114 hash_or[1][k] |= h1 = hash_64(h64, k); in test_int_hash()
116 pr_err("hash_64(%#llx, %d) = %#x > %#x", h64, k, h1, m); in test_int_hash()
120 h2 = hash_64_generic(h64, k); in test_int_hash()
124 "= %#x", h64, k, h1, h2); in test_int_hash()
130 h64, k, h1, m); in test_int_hash()
150 int i, j; in test_hash_init() local
154 /* Test every possible non-empty substring in the buffer. */ in test_hash_init()
155 for (j = SIZE; j > 0; --j) { in test_hash_init()
156 buf[j] = '\0'; in test_hash_init()
158 for (i = 0; i <= j; i++) { in test_hash_init()
160 u32 h0 = full_name_hash(buf+i, buf+i, j-i); in test_hash_init()
163 if (hashlen_len(hashlen) != j-i) { in test_hash_init()
166 i, j, hashlen_len(hashlen), j-i); in test_hash_init()
167 return -EINVAL; in test_hash_init()
173 i, j, hashlen_hash(hashlen), h0); in test_hash_init()
174 return -EINVAL; in test_hash_init()
180 return -EINVAL; in test_hash_init()
183 } /* j */ in test_hash_init()
188 string_or, -1u); in test_hash_init()
189 return -EINVAL; in test_hash_init()
193 hash_or[0][0], -1u); in test_hash_init()
194 return -EINVAL; in test_hash_init()
200 hash_or[1][0], -1u); in test_hash_init()
201 return -EINVAL; in test_hash_init()
206 /* Likewise for all the i-bit hash values */ in test_hash_init()
208 u32 const m = ((u32)2 << (i-1)) - 1; /* Low i bits set */ in test_hash_init()
213 return -EINVAL; in test_hash_init()
218 return -EINVAL; in test_hash_init()
225 pr_info("__hash_32() is arch-specific; not compared to generic."); in test_hash_init()
228 pr_info("__hash_32() has no arch implementation to test."); in test_hash_init()
232 pr_info("hash_32() is arch-specific; not compared to generic."); in test_hash_init()
235 pr_info("hash_32() has no arch implementation to test."); in test_hash_init()
239 pr_info("hash_64() is arch-specific; not compared to generic."); in test_hash_init()
242 pr_info("hash_64() has no arch implementation to test."); in test_hash_init()