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

References i.

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

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