PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
dynahash.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int my_log2 (long num)
 

Function Documentation

int my_log2 ( long  num)

Definition at line 1682 of file dynahash.c.

References i.

Referenced by ExecChooseHashTableSize(), ExecHashTableCreate(), hash_create(), next_pow2_int(), and next_pow2_long().

1683 {
1684  int i;
1685  long limit;
1686 
1687  /* guard against too-large input, which would put us into infinite loop */
1688  if (num > LONG_MAX / 2)
1689  num = LONG_MAX / 2;
1690 
1691  for (i = 0, limit = 1; limit < num; i++, limit <<= 1)
1692  ;
1693  return i;
1694 }
int i