Woolz Image Processing  Version 1.7.5
AlgBits.c File Reference

Provides bit fiddling functions. More...

Functions

unsigned int AlgBitSetCount (unsigned long gMsk)
 Counts the number of bits set in the given mask. More...
 
int AlgBitMostSigSet (unsigned long gMsk)
 Finds the most significant bit set in the given mask. The value returned will be zero if the mask was zero one if the mask had the value 1 or higher integer if the most significant bit set in the mask is greater. More...
 
int AlgBitMostSigSetLL (unsigned long long gMsk)
 Finds the most significant bit set in the given mask. The value returned will be zero if the mask was zero one if the mask had the value 1 or higher integer if the most significant bit set in the mask is greater. More...
 
unsigned int AlgBitSetPositions (unsigned int *posA, unsigned long gMsk)
 Counts the number of bits set in the given mask and sets the first elements of the given bit position array. More...
 
unsigned int AlgBitRotateRight (unsigned int g, unsigned int n, unsigned int d)
 Rotates the given bit mask d places to the right (towards less significant bits) where there are n valid bits in the given bit mask. More...
 
unsigned int AlgBitRotateLeft (unsigned int g, unsigned int n, unsigned int d)
 
unsigned long AlgBitNextNOfM (unsigned long curMsk, int n, int m)
 Computes a bit mask which has n bits set and is <= maxMsk, the new bit mask is the next after the given current mask. The maximum number of bits that can be stored in an unsigned long is assumed to be 32. If the actual number is less than this then this code won't work, if it's higher everything should be fine. This function can be used together with AlgBitSetPositions() to select all ordered combinations of N of M. Eg to select all ordered combinations of 3 out of 5 this function would return 00111, 01011, 01101, 01110, 10110, 11010, 11100. More...
 
int AlgBitNextSet (unsigned long msk, int idC)
 Computes the index of the next bit set in the given mask using the index to the current bit as the start index. maxMsk, the new bit mask is the next after the given current mask. More...
 
int AlgBitNextPowerOfTwo (unsigned int *dstP2I, unsigned int gI)
 Computes the next integer that is >= the given integer and has only a single bit set. More...
 
int AlgBitIsPowerOfTwo (unsigned int gI)
 Checks that the given integer is an integral power of two. More...
 

Detailed Description

Provides bit fiddling functions.

Author
Bill Hill
Date
May 2000
Version
Id
cc6b5d48b43831ac7530cd5051b9f7e02cd8ab8b
Address: MRC Human Genetics Unit, MRC Institute of Genetics and Molecular Medicine, University of Edinburgh, Western General Hospital, Edinburgh, EH4 2XU, UK.
Copyright (C), [2012], The University Court of the University of Edinburgh, Old College, Edinburgh, UK.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Function Documentation

unsigned int AlgBitRotateLeft ( unsigned int  g,
unsigned int  n,
unsigned int  d 
)