Logo Search packages:      
Sourcecode: librasterlite version File versions  Download package

int number_of_bits ( int  value )

Number of bits in the value

This function computes the number of bits in the value (e.g. number_of_bits(13) = 4).

Parameters:
valueTarget value
Returns:
Number of bits

Definition at line 26 of file common.c.

References GET_BYTE, and NUMBER_OF_BITS.

Referenced by alloc_LIS_slots(), analysis_2D(), decode_sorting_pass(), encode_sorting_pass(), free_LIS_slots(), get_block_size(), is_power_of_two(), speck_encode(), split_set(), synthesis_2D(), and validate_set().

{
    int bits;

    bits = NUMBER_OF_BITS(GET_BYTE(value, 3));
    if (bits) return bits + 24;

    bits = NUMBER_OF_BITS(GET_BYTE(value, 2));
    if (bits) return bits + 16;

    bits = NUMBER_OF_BITS(GET_BYTE(value, 1));
    if (bits) return bits + 8;

    bits = NUMBER_OF_BITS(GET_BYTE(value, 0));
    if (bits) return bits;

    return 0;
}

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index