PostgreSQL Source Code  git master
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

◆ my_log2()

int my_log2 ( long  num)

Definition at line 1718 of file dynahash.c.

References i.

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

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