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*50997Sbostic static char sccsid[] = "@(#)hash_log2.c 5.2 (Berkeley) 09/04/91"; 1346370Sbostic #endif /* LIBC_SCCS and not lint */ 1446370Sbostic 15*50997Sbostic #include <sys/types.h> 16*50997Sbostic #include <db.h> 17*50997Sbostic #include "hash.h" 18*50997Sbostic #include "page.h" 19*50997Sbostic #include "extern.h" 20*50997Sbostic 21*50997Sbostic int 22*50997Sbostic __log2(num) 23*50997Sbostic int num; 2446370Sbostic { 25*50997Sbostic register int i, limit; 2646370Sbostic 27*50997Sbostic limit = 1; 28*50997Sbostic for (i = 0; limit < num; limit = limit << 1, i++); 29*50997Sbostic return (i); 3046370Sbostic } 31