# Ogre::Bitwise Class Reference

Class for manipulating bit patterns. More...

`#include <OgreBitwise.h>`

List of all members.

## Static Public Member Functions

template<typename T> FORCEINLINE unsigned int | getBitShift (T mask)
| Returns the number of bits a pattern must be shifted right by to remove right-hand zeroes.
template<typename SrcT, typename DestT> DestT | convertBitPattern (SrcT srcValue, SrcT srcBitMask, DestT destBitMask)
| Takes a value with a given src bit mask, and produces another value with a desired bit mask.
unsigned int | fixedToFixed (uint32 value, unsigned int n, unsigned int p)
| Convert N bit colour channel value to P bits.
unsigned int | floatToFixed (const float value, const unsigned int bits)
| Convert floating point colour channel value between 0.0 and 1.0 (otherwise clamped) to integer of a certain number of bits.
float | fixedToFloat (unsigned value, unsigned int bits)
| Fixed point to float.
void | intWrite (const void *dest, const int n, const unsigned int value)
| Write a n*8 bits integer value to memory in native endian.
unsigned int | intRead (const void *src, int n)
| Read a n*8 bits integer value to memory in native endian.
uint16 | floatToHalf (float i)
| Convert a float32 to a float16 (NV_half_float) Courtesy of OpenEXR.
uint16 | floatToHalfI (uint32 i)
| Converts float in uint32 format to a a half in uint16 format.
float | halfToFloat (uint16 y)
| Convert a float16 (NV_half_float) to a float32 Courtesy of OpenEXR.
uint32 | halfToFloatI (uint16 y)
| Converts a half in uint16 format to a float in uint32 format.

## Detailed Description

Class for manipulating bit patterns.

Definition at line 34 of file OgreBitwise.h.

## Member Function Documentation

template<typename SrcT, typename DestT>
DestT Ogre::Bitwise::convertBitPattern | ( | SrcT | srcValue,
|  | SrcT | srcBitMask,
|  | DestT | destBitMask
| ) | `[static]`

Takes a value with a given src bit mask, and produces another value with a desired bit mask.

Remarks:
  This routine is useful for colour conversion.

Definition at line 59 of file OgreBitwise.h.

References getBitShift().

unsigned int Ogre::Bitwise::fixedToFixed | ( | uint32 | value,
|  | unsigned int | n,
|  | unsigned int | p
| ) | `[static]`

| Convert N bit colour channel value to P bits. It fills P bits with the bit pattern repeated. (this is /((1<<n)-1) in fixed point) Definition at line 84 of file OgreBitwise.h. References Ogre::uint32.

float Ogre::Bitwise::fixedToFloat | ( | unsigned | value,
|  | unsigned int | bits
| ) | `[static]`

| Fixed point to float. Definition at line 118 of file OgreBitwise.h.

unsigned int Ogre::Bitwise::floatToFixed | ( | const float | value,
|  | const unsigned int | bits
| ) | `[static]`

| Convert floating point colour channel value between 0.0 and 1.0 (otherwise clamped) to integer of a certain number of bits. Works for any value of bits between 0 and 31. Definition at line 108 of file OgreBitwise.h.

uint16 Ogre::Bitwise::floatToHalf | ( | float | i | ) | `[static]`

| Convert a float32 to a float16 (NV_half_float) Courtesy of OpenEXR. Definition at line 179 of file OgreBitwise.h. References floatToHalfI(), and Ogre::uint16.

uint16 Ogre::Bitwise::floatToHalfI | ( | uint32 | i | ) | `[static]`

| Converts float in uint32 format to a a half in uint16 format. Definition at line 185 of file OgreBitwise.h. References Ogre::uint16, and Ogre::uint32. Referenced by floatToHalf().

template<typename T>
FORCEINLINE unsigned int Ogre::Bitwise::getBitShift | ( | T | mask | ) | `[static]`

| Returns the number of bits a pattern must be shifted right by to remove right-hand zeroes. Definition at line 40 of file OgreBitwise.h. References FORCEINLINE. Referenced by convertBitPattern().

float Ogre::Bitwise::halfToFloat | ( | uint16 | y | ) | `[static]`

| Convert a float16 (NV_half_float) to a float32 Courtesy of OpenEXR. Definition at line 228 of file OgreBitwise.h. References halfToFloatI(), Ogre::uint16, and Ogre::uint32.

uint32 Ogre::Bitwise::halfToFloatI | ( | uint16 | y | ) | `[static]`

| Converts a half in uint16 format to a float in uint32 format. Definition at line 236 of file OgreBitwise.h. References Ogre::uint16, and Ogre::uint32. Referenced by halfToFloat().

unsigned int Ogre::Bitwise::intRead | ( | const void * | src,
|  | int | n
| ) | `[static]`

| Read a n*8 bits integer value to memory in native endian. Definition at line 154 of file OgreBitwise.h. References Ogre::uint16, Ogre::uint32, and Ogre::uint8.

void Ogre::Bitwise::intWrite | ( | const void * | dest,
|  | const int | n,
|  | const unsigned int | value
| ) | `[static]`

| Write a n*8 bits integer value to memory in native endian. Definition at line 126 of file OgreBitwise.h. References Ogre::uint16, Ogre::uint32, and Ogre::uint8.

The documentation for this class was generated from the following file:

- OgreBitwise.h

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Nov 20 12:36:22 2005