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 1680 of file dynahash.c.

References i.

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

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