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 (unsigned int x)
| Returns the number of 1 bits in the indicated word. More...
int | count_bits_in_word (unsigned long long x)
| Returns the number of 1 bits in the indicated word. More...
int | count_bits_in_word (unsigned long x)
| Returns the number of 1 bits in the indicated word. More...
int | count_bits_in_word (unsigned short x)
| Returns the number of 1 bits in the indicated word. More...
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. More...
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. More...
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. More...
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. More...
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. More...
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. More...
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. More...
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. More...
int | get_highest_on_bit (unsigned int x)
| Returns the index of the highest 1 bit in the word. More...
int | get_highest_on_bit (unsigned long long x)
| Returns the index of the highest 1 bit in the word. More...
int | get_highest_on_bit (unsigned long x)
| Returns the index of the highest 1 bit in the word. More...
int | get_highest_on_bit (unsigned short x)
| Returns the index of the highest 1 bit in the word. More...
int | get_lowest_on_bit (unsigned int x)
| Returns the index of the lowest 1 bit in the word. More...
int | get_lowest_on_bit (unsigned long long x)
| Returns the index of the lowest 1 bit in the word. More...
int | get_lowest_on_bit (unsigned long x)
| Returns the index of the lowest 1 bit in the word. More...
int | get_lowest_on_bit (unsigned short x)
| Returns the index of the lowest 1 bit in the word. More...
int | get_next_higher_bit (unsigned int x)
| Returns the smallest power of 2 greater than x. More...
int | get_next_higher_bit (unsigned long long x)
| Returns the smallest power of 2 greater than x. More...
int | get_next_higher_bit (unsigned long x)
| Returns the smallest power of 2 greater than x. More...
int | get_next_higher_bit (unsigned short 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/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

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(), and get_lowest_on_bit().

## ◆ 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 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.

## ◆ 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_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.

## ◆ 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 Texture::down_to_power_2(), and Texture::up_to_power_2().