146370Sbostic /*- 246370Sbostic * Copyright (c) 1990 The Regents of the University of California. 346370Sbostic * All rights reserved. 446370Sbostic * 546370Sbostic * This code is derived from software contributed to Berkeley by 646370Sbostic * Margo Seltzer. 746370Sbostic * 846370Sbostic * %sccs.include.redist.c% 946370Sbostic */ 1046370Sbostic 1146370Sbostic #if defined(LIBC_SCCS) && !defined(lint) 12*51059Sbostic static char sccsid[] = "@(#)hash_log2.c 5.3 (Berkeley) 09/08/91"; 1346370Sbostic #endif /* LIBC_SCCS and not lint */ 1446370Sbostic 1550997Sbostic #include <sys/types.h> 1650997Sbostic #include <db.h> 1750997Sbostic #include "hash.h" 1850997Sbostic #include "page.h" 1950997Sbostic #include "extern.h" 2050997Sbostic 21*51059Sbostic u_int 2250997Sbostic __log2(num) 23*51059Sbostic u_int num; 2446370Sbostic { 25*51059Sbostic register u_int i, limit; 2646370Sbostic 2750997Sbostic limit = 1; 2850997Sbostic for (i = 0; limit < num; limit = limit << 1, i++); 2950997Sbostic return (i); 3046370Sbostic } 31