Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

util::BitOperation Class Reference

#include <BitOperation.h>

List of all members.


Detailed Description

A wrapper class for conventional naming of static functions for performing bit operations.


Static Public Methods

unsigned int ror (unsigned int c, int n, int bits=8)
 Rotate a binary code right by n positions.

unsigned int rol (unsigned int c, int n, int bits=8)
 Rotate a binary code left by n positions.

int onecount (unsigned int c, int bits=8)
 Get the number of ones in a binary number.

int transitions (unsigned int c, int bits=8)
 Get the number of 0-to-1 or 1-to-0 transitions in a binary number.

unsigned int rotmin (unsigned int n, int bits=8)
 Rotate a binary number to its minimum value.

int hammingDistance (unsigned int a, unsigned int b, int bits=8)
 Calculate the Hamming distance between two binary numbers.

std::string binary (unsigned int a, int bits=8)
 Get a textual representation for a binary number.


Member Function Documentation

string util::BitOperation::binary unsigned int    a,
int    bits = 8
[static]
 

Get a textual representation for a binary number.

Parameters:
a  the number
bits  the number of bits to consider
Returns:
a binary representation of a

int util::BitOperation::hammingDistance unsigned int    a,
unsigned int    b,
int    bits = 8
[static]
 

Calculate the Hamming distance between two binary numbers.

Parameters:
a  a number
b  another number
bits  the number of bits to consider

int util::BitOperation::onecount unsigned int    c,
int    bits = 8
[static]
 

Get the number of ones in a binary number.

Parameters:
c  the number
bits  the number of bits to consider

unsigned int util::BitOperation::rol unsigned int    c,
int    n,
int    bits = 8
[inline, static]
 

Rotate a binary code left by n positions.

Parameters:
c  the number to be rotated
n  the number of positions to rotate
bits  the number of bits to consider

unsigned int util::BitOperation::ror unsigned int    c,
int    n,
int    bits = 8
[inline, static]
 

Rotate a binary code right by n positions.

Parameters:
c  the number to be rotated
n  the number of positions to rotate
bits  the number of bits to consider

unsigned int util::BitOperation::rotmin unsigned int    n,
int    bits = 8
[static]
 

Rotate a binary number to its minimum value.

Parameters:
c  the number
bits  the number of bits to consider

int util::BitOperation::transitions unsigned int    c,
int    bits = 8
[static]
 

Get the number of 0-to-1 or 1-to-0 transitions in a binary number.

Parameters:
c  the number
bits  the number of bits to consider


The documentation for this class was generated from the following files:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.