Panda3D
Functions
pbitops.I File Reference

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. More...

Go to the source code of this file.

Functions

int count_bits_in_word (uint16_t x)
 Returns the number of 1 bits in the indicated word. More...
 
int count_bits_in_word (uint32_t x)
 Returns the number of 1 bits in the indicated word. More...
 
int count_bits_in_word (uint64_t x)
 Returns the number of 1 bits in the indicated word. More...
 
uint16_t flood_bits_down (uint16_t x)
 Returns a value such that every bit at or below the highest bit in x is 1. More...
 
uint32_t flood_bits_down (uint32_t x)
 Returns a value such that every bit at or below the highest bit in x is 1. More...
 
uint64_t flood_bits_down (uint64_t x)
 Returns a value such that every bit at or below the highest bit in x is 1. More...
 
uint16_t flood_bits_up (uint16_t x)
 Returns a value such that every bit at or above the highest bit in x is 1. More...
 
uint32_t flood_bits_up (uint32_t x)
 Returns a value such that every bit at or above the highest bit in x is 1. More...
 
uint64_t flood_bits_up (uint64_t x)
 Returns a value such that every bit at or above the highest bit in x is 1. More...
 
int get_highest_on_bit (uint16_t x)
 Returns the index of the highest 1 bit in the word. More...
 
int get_highest_on_bit (uint32_t x)
 Returns the index of the highest 1 bit in the word. More...
 
int get_highest_on_bit (uint64_t x)
 Returns the index of the highest 1 bit in the word. More...
 
int get_lowest_on_bit (uint16_t x)
 Returns the index of the lowest 1 bit in the word. More...
 
int get_lowest_on_bit (uint32_t x)
 Returns the index of the lowest 1 bit in the word. More...
 
int get_lowest_on_bit (uint64_t x)
 Returns the index of the lowest 1 bit in the word. More...
 
int get_next_higher_bit (uint16_t x)
 Returns the smallest power of 2 greater than x. More...
 
int get_next_higher_bit (uint32_t x)
 Returns the smallest power of 2 greater than x. More...
 
int get_next_higher_bit (uint64_t x)
 Returns the smallest power of 2 greater than x. More...
 

Detailed Description

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.

All rights reserved.

All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."

Author
drose
Date
2008-05-10

Definition in file pbitops.I.

Function Documentation

◆ count_bits_in_word() [1/3]

int count_bits_in_word ( uint16_t  x)
inline

Returns the number of 1 bits in the indicated word.

Definition at line 18 of file pbitops.I.

Referenced by count_bits_in_word(), get_highest_on_bit(), get_lowest_on_bit(), BitMask< uint32_t, 32 >::get_num_off_bits(), and BitMask< uint32_t, 32 >::get_num_on_bits().

◆ count_bits_in_word() [2/3]

int count_bits_in_word ( uint32_t  x)
inline

Returns the number of 1 bits in the indicated word.

Definition at line 26 of file pbitops.I.

◆ count_bits_in_word() [3/3]

int count_bits_in_word ( uint64_t  x)
inline

Returns the number of 1 bits in the indicated word.

Definition at line 38 of file pbitops.I.

References count_bits_in_word().

◆ flood_bits_down() [1/3]

uint16_t flood_bits_down ( uint16_t  x)
inline

Returns a value such that every bit at or below the highest bit in x is 1.

Definition at line 50 of file pbitops.I.

Referenced by BitMask< uint32_t, 32 >::flood_bits_down(), BitMask< uint32_t, 32 >::flood_down_in_place(), and get_highest_on_bit().

◆ flood_bits_down() [2/3]

uint32_t flood_bits_down ( uint32_t  x)
inline

Returns a value such that every bit at or below the highest bit in x is 1.

Definition at line 62 of file pbitops.I.

◆ flood_bits_down() [3/3]

uint64_t flood_bits_down ( uint64_t  x)
inline

Returns a value such that every bit at or below the highest bit in x is 1.

Definition at line 75 of file pbitops.I.

◆ flood_bits_up() [1/3]

uint16_t flood_bits_up ( uint16_t  x)
inline

Returns a value such that every bit at or above the highest bit in x is 1.

Definition at line 89 of file pbitops.I.

Referenced by BitMask< uint32_t, 32 >::flood_bits_up(), and BitMask< uint32_t, 32 >::flood_up_in_place().

◆ flood_bits_up() [2/3]

uint32_t flood_bits_up ( uint32_t  x)
inline

Returns a value such that every bit at or above the highest bit in x is 1.

Definition at line 101 of file pbitops.I.

◆ flood_bits_up() [3/3]

uint64_t flood_bits_up ( uint64_t  x)
inline

Returns a value such that every bit at or above the highest bit in x is 1.

Definition at line 114 of file pbitops.I.

◆ get_highest_on_bit() [1/3]

int get_highest_on_bit ( uint16_t  x)
inline

Returns the index of the highest 1 bit in the word.

Returns -1 if there are no 1 bits.

Definition at line 192 of file pbitops.I.

References count_bits_in_word(), and flood_bits_down().

Referenced by BitMask< uint32_t, 32 >::get_highest_on_bit(), get_next_higher_bit(), and BitMask< uint32_t, 32 >::keep_next_lowest_bit().

◆ get_highest_on_bit() [2/3]

int get_highest_on_bit ( uint32_t  x)
inline

Returns the index of the highest 1 bit in the word.

Returns -1 if there are no 1 bits.

Definition at line 209 of file pbitops.I.

References count_bits_in_word(), and flood_bits_down().

◆ get_highest_on_bit() [3/3]

int get_highest_on_bit ( uint64_t  x)
inline

Returns the index of the highest 1 bit in the word.

Returns -1 if there are no 1 bits.

Definition at line 226 of file pbitops.I.

References count_bits_in_word(), and flood_bits_down().

◆ get_lowest_on_bit() [1/3]

int get_lowest_on_bit ( uint16_t  x)
inline

Returns the index of the lowest 1 bit in the word.

Returns -1 if there are no 1 bits.

Definition at line 129 of file pbitops.I.

Referenced by BitMask< uint32_t, 32 >::get_lowest_on_bit(), and BitMask< uint32_t, 32 >::keep_next_highest_bit().

◆ get_lowest_on_bit() [2/3]

int get_lowest_on_bit ( uint32_t  x)
inline

Returns the index of the lowest 1 bit in the word.

Returns -1 if there are no 1 bits.

Definition at line 150 of file pbitops.I.

References count_bits_in_word().

◆ get_lowest_on_bit() [3/3]

int get_lowest_on_bit ( uint64_t  x)
inline

Returns the index of the lowest 1 bit in the word.

Returns -1 if there are no 1 bits.

Definition at line 171 of file pbitops.I.

References count_bits_in_word().

◆ get_next_higher_bit() [1/3]

int get_next_higher_bit ( uint16_t  x)
inline

Returns the smallest power of 2 greater than x.

Returns the smallest number n such that (1 << n) is larger than x.

Definition at line 244 of file pbitops.I.

References get_highest_on_bit().

Referenced by Texture::down_to_power_2(), and Texture::up_to_power_2().

◆ get_next_higher_bit() [2/3]

int get_next_higher_bit ( uint32_t  x)
inline

Returns the smallest power of 2 greater than x.

Returns the smallest number n such that (1 << n) is larger than x.

Definition at line 254 of file pbitops.I.

References get_highest_on_bit().

◆ get_next_higher_bit() [3/3]

int get_next_higher_bit ( uint64_t  x)
inline

Returns the smallest power of 2 greater than x.

Returns the smallest number n such that (1 << n) is larger than x.

Definition at line 264 of file pbitops.I.

References get_highest_on_bit().