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

References i.

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

1715 {
1716  int i;
1717  long limit;
1718 
1719  /* guard against too-large input, which would put us into infinite loop */
1720  if (num > LONG_MAX / 2)
1721  num = LONG_MAX / 2;
1722 
1723  for (i = 0, limit = 1; limit < num; i++, limit <<= 1)
1724  ;
1725  return i;
1726 }
int i