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

References pg_ceil_log2_32(), and pg_ceil_log2_64().

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

1721 {
1722  /*
1723  * guard against too-large input, which would be invalid for
1724  * pg_ceil_log2_*()
1725  */
1726  if (num > LONG_MAX / 2)
1727  num = LONG_MAX / 2;
1728 
1729 #if SIZEOF_LONG < 8
1730  return pg_ceil_log2_32(num);
1731 #else
1732  return pg_ceil_log2_64(num);
1733 #endif
1734 }
static uint64 pg_ceil_log2_64(uint64 num)
Definition: pg_bitutils.h:202
static uint32 pg_ceil_log2_32(uint32 num)
Definition: pg_bitutils.h:189