Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions

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

References i.

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

{
    int         i;
    long        limit;

    /* guard against too-large input, which would put us into infinite loop */
    if (num > LONG_MAX / 2)
        num = LONG_MAX / 2;

    for (i = 0, limit = 1; limit < num; i++, limit <<= 1)
        ;
    return i;
}