var.c (250837) | var.c (251422) |
---|---|
1/* $NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $ */ | 1/* $NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $ */ |
2 3/* 4 * Copyright (c) 1988, 1989, 1990, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Adam de Boor. 9 * --- 54 unchanged lines hidden (view full) --- 64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 68 * SUCH DAMAGE. 69 */ 70 71#ifndef MAKE_NATIVE | 2 3/* 4 * Copyright (c) 1988, 1989, 1990, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Adam de Boor. 9 * --- 54 unchanged lines hidden (view full) --- 64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 68 * SUCH DAMAGE. 69 */ 70 71#ifndef MAKE_NATIVE |
72static char rcsid[] = "$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $"; | 72static char rcsid[] = "$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $"; |
73#else 74#include <sys/cdefs.h> 75#ifndef lint 76#if 0 77static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; 78#else | 73#else 74#include <sys/cdefs.h> 75#ifndef lint 76#if 0 77static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; 78#else |
79__RCSID("$NetBSD: var.c,v 1.174 2013/05/18 13:12:45 sjg Exp $"); | 79__RCSID("$NetBSD: var.c,v 1.175 2013/05/29 00:23:31 sjg Exp $"); |
80#endif 81#endif /* not lint */ 82#endif 83 84/*- 85 * var.c -- 86 * Variable-handling functions 87 * --- 2233 unchanged lines hidden (view full) --- 2321static char * 2322VarHash(char *str) 2323{ 2324 static const char hexdigits[16] = "0123456789abcdef"; 2325 Buffer buf; 2326 size_t len, len2; 2327 unsigned char *ustr = (unsigned char *)str; 2328 uint32_t h, k, c1, c2; | 80#endif 81#endif /* not lint */ 82#endif 83 84/*- 85 * var.c -- 86 * Variable-handling functions 87 * --- 2233 unchanged lines hidden (view full) --- 2321static char * 2322VarHash(char *str) 2323{ 2324 static const char hexdigits[16] = "0123456789abcdef"; 2325 Buffer buf; 2326 size_t len, len2; 2327 unsigned char *ustr = (unsigned char *)str; 2328 uint32_t h, k, c1, c2; |
2329 int done; | |
2330 | 2329 |
2331 done = 1; | |
2332 h = 0x971e137bU; 2333 c1 = 0x95543787U; 2334 c2 = 0x2ad7eb25U; 2335 len2 = strlen(str); 2336 2337 for (len = len2; len; ) { 2338 k = 0; 2339 switch (len) { --- 13 unchanged lines hidden (view full) --- 2353 c1 = c1 * 5 + 0x7b7d159cU; 2354 c2 = c2 * 5 + 0x6bce6396U; 2355 k *= c1; 2356 k = (k << 11) ^ (k >> 21); 2357 k *= c2; 2358 h = (h << 13) ^ (h >> 19); 2359 h = h * 5 + 0x52dce729U; 2360 h ^= k; | 2330 h = 0x971e137bU; 2331 c1 = 0x95543787U; 2332 c2 = 0x2ad7eb25U; 2333 len2 = strlen(str); 2334 2335 for (len = len2; len; ) { 2336 k = 0; 2337 switch (len) { --- 13 unchanged lines hidden (view full) --- 2351 c1 = c1 * 5 + 0x7b7d159cU; 2352 c2 = c2 * 5 + 0x6bce6396U; 2353 k *= c1; 2354 k = (k << 11) ^ (k >> 21); 2355 k *= c2; 2356 h = (h << 13) ^ (h >> 19); 2357 h = h * 5 + 0x52dce729U; 2358 h ^= k; |
2361 } while (!done); | 2359 } |
2362 h ^= len2; 2363 h *= 0x85ebca6b; 2364 h ^= h >> 13; 2365 h *= 0xc2b2ae35; 2366 h ^= h >> 16; 2367 2368 Buf_Init(&buf, 0); 2369 for (len = 0; len < 8; ++len) { --- 1857 unchanged lines hidden --- | 2360 h ^= len2; 2361 h *= 0x85ebca6b; 2362 h ^= h >> 13; 2363 h *= 0xc2b2ae35; 2364 h ^= h >> 16; 2365 2366 Buf_Init(&buf, 0); 2367 for (len = 0; len < 8; ++len) { --- 1857 unchanged lines hidden --- |