Panda3D
Loading...
Searching...
No Matches
Functions | Variables
pbitops.h File Reference

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

#include "pandabase.h"
#include "numeric_types.h"
#include "pbitops.I"

Go to the source code of this file.

Functions

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

Variables

EXPCL_PANDA_PUTIL const unsigned char num_bits_on [65536]
 

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.h.

Function Documentation

◆ count_bits_in_word() [1/4]

int count_bits_in_word ( unsigned int x)
inline

Returns the number of 1 bits in the indicated word.

Definition at line 26 of file pbitops.I.

◆ count_bits_in_word() [2/4]

int count_bits_in_word ( unsigned long long x)
inline

Returns the number of 1 bits in the indicated word.

Definition at line 52 of file pbitops.I.

References count_bits_in_word().

◆ count_bits_in_word() [3/4]

int count_bits_in_word ( unsigned long 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().

◆ count_bits_in_word() [4/4]

int count_bits_in_word ( unsigned short x)
inline

◆ flood_bits_down() [1/4]

unsigned int flood_bits_down ( unsigned int x)
inline

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

Definition at line 76 of file pbitops.I.

◆ flood_bits_down() [2/4]

unsigned long long flood_bits_down ( unsigned long long x)
inline

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

Definition at line 105 of file pbitops.I.

◆ flood_bits_down() [3/4]

unsigned long flood_bits_down ( unsigned long x)
inline

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

Definition at line 89 of file pbitops.I.

◆ flood_bits_down() [4/4]

unsigned short flood_bits_down ( unsigned short x)
inline

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

Definition at line 64 of file pbitops.I.

Referenced by BitMask< WType, nbits >::flood_bits_down(), BitMask< WType, nbits >::flood_down_in_place(), get_highest_on_bit(), get_highest_on_bit(), get_highest_on_bit(), and get_highest_on_bit().

◆ flood_bits_up() [1/4]

unsigned int flood_bits_up ( unsigned int x)
inline

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

Definition at line 131 of file pbitops.I.

◆ flood_bits_up() [2/4]

unsigned long long flood_bits_up ( unsigned long long x)
inline

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

Definition at line 160 of file pbitops.I.

◆ flood_bits_up() [3/4]

unsigned long flood_bits_up ( unsigned long x)
inline

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

Definition at line 144 of file pbitops.I.

◆ flood_bits_up() [4/4]

unsigned short flood_bits_up ( unsigned short x)
inline

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

Definition at line 119 of file pbitops.I.

Referenced by BitMask< WType, nbits >::flood_bits_up(), and BitMask< WType, nbits >::flood_up_in_place().

◆ get_highest_on_bit() [1/4]

int get_highest_on_bit ( unsigned int x)
inline

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

Returns -1 if there are no 1 bits.

Definition at line 276 of file pbitops.I.

References count_bits_in_word(), and flood_bits_down().

◆ get_highest_on_bit() [2/4]

int get_highest_on_bit ( unsigned long long x)
inline

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

Returns -1 if there are no 1 bits.

Definition at line 310 of file pbitops.I.

References count_bits_in_word(), and flood_bits_down().

◆ get_highest_on_bit() [3/4]

int get_highest_on_bit ( unsigned long x)
inline

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

Returns -1 if there are no 1 bits.

Definition at line 293 of file pbitops.I.

References count_bits_in_word(), and flood_bits_down().

◆ get_highest_on_bit() [4/4]

int get_highest_on_bit ( unsigned short x)
inline

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

Returns -1 if there are no 1 bits.

Definition at line 259 of file pbitops.I.

References count_bits_in_word(), and flood_bits_down().

Referenced by get_next_higher_bit(), get_next_higher_bit(), get_next_higher_bit(), get_next_higher_bit(), and BitMask< WType, nbits >::keep_next_lowest_bit().

◆ get_lowest_on_bit() [1/4]

int get_lowest_on_bit ( unsigned int x)
inline

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

Returns -1 if there are no 1 bits.

Definition at line 196 of file pbitops.I.

References count_bits_in_word().

◆ get_lowest_on_bit() [2/4]

int get_lowest_on_bit ( unsigned long long x)
inline

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

Returns -1 if there are no 1 bits.

Definition at line 238 of file pbitops.I.

References count_bits_in_word().

◆ get_lowest_on_bit() [3/4]

int get_lowest_on_bit ( unsigned long x)
inline

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

Returns -1 if there are no 1 bits.

Definition at line 217 of file pbitops.I.

References count_bits_in_word().

◆ get_lowest_on_bit() [4/4]

int get_lowest_on_bit ( unsigned short x)
inline

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

Returns -1 if there are no 1 bits.

Definition at line 175 of file pbitops.I.

Referenced by BitMask< WType, nbits >::keep_next_highest_bit().

◆ get_next_higher_bit() [1/4]

int get_next_higher_bit ( unsigned int 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 338 of file pbitops.I.

References get_highest_on_bit().

◆ get_next_higher_bit() [2/4]

int get_next_higher_bit ( unsigned long long 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 358 of file pbitops.I.

References get_highest_on_bit().

◆ get_next_higher_bit() [3/4]

int get_next_higher_bit ( unsigned long 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 348 of file pbitops.I.

References get_highest_on_bit().

◆ get_next_higher_bit() [4/4]

int get_next_higher_bit ( unsigned short 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 328 of file pbitops.I.

References get_highest_on_bit().

Referenced by GeomVertexArrayDataHandle::copy_subdata_from(), Texture::down_to_power_2(), GeomVertexArrayDataHandle::set_subdata(), and Texture::up_to_power_2().

Variable Documentation

◆ num_bits_on

EXPCL_PANDA_PUTIL const unsigned char num_bits_on[65536]
extern

Definition at line 20 of file pbitops.cxx.