Tesseract 3.01
/data/source/tesseract-ocr/cutil/bitvec.h File Reference
#include "host.h"

Go to the source code of this file.

Defines

#define BITSINLONG   32
#define zero_all_bits(array, length)
#define set_all_bits(array, length)
#define copy_all_bits(source, dest, length)
#define SET_BIT(array, bit)   (array[bit/BITSINLONG]|=1<<(bit&(BITSINLONG-1)))
#define reset_bit(array, bit)   (array[bit/BITSINLONG]&=~(1<<(bit&(BITSINLONG-1))))
#define test_bit(array, bit)   (array[bit/BITSINLONG] & (1<<(bit&(BITSINLONG-1))))
#define WordsInVectorOfSize(NumBits)   (((NumBits) + BITSINLONG - 1) / BITSINLONG)

Typedefs

typedef uinT32BIT_VECTOR

Functions

BIT_VECTOR ExpandBitVector (BIT_VECTOR Vector, int NewNumBits)
void FreeBitVector (BIT_VECTOR BitVector)
int hamming_distance (uinT32 *array1, uinT32 *array2, int length)
BIT_VECTOR NewBitVector (int NumBits)

Define Documentation

#define BITSINLONG   32

no of bits in a long

#define copy_all_bits (   source,
  dest,
  length 
)
Value:
{\
    register int            index;                        /*temporary index*/\
\
for (index=0;index<length;index++)\
    dest[index]=source[index];                            /*copy all bits*/\
}
#define reset_bit (   array,
  bit 
)    (array[bit/BITSINLONG]&=~(1<<(bit&(BITSINLONG-1))))
#define set_all_bits (   array,
  length 
)
Value:
{\
    register int            index;                        /*temporary index*/\
\
for (index=0;index<length;index++)\
    array[index]= ~0;                                    /*set all bits*/\
}
#define SET_BIT (   array,
  bit 
)    (array[bit/BITSINLONG]|=1<<(bit&(BITSINLONG-1)))
#define test_bit (   array,
  bit 
)    (array[bit/BITSINLONG] & (1<<(bit&(BITSINLONG-1))))
#define WordsInVectorOfSize (   NumBits)    (((NumBits) + BITSINLONG - 1) / BITSINLONG)
#define zero_all_bits (   array,
  length 
)
Value:
{\
    register int            index;                        /*temporary index*/\
\
for (index=0;index<length;index++)\
    array[index]=0;                                        /*zero all bits*/\
}

Typedef Documentation

typedef uinT32* BIT_VECTOR

Function Documentation

BIT_VECTOR ExpandBitVector ( BIT_VECTOR  Vector,
int  NewNumBits 
)

This routine uses realloc to increase the size of the specified bit vector.

Globals:

  • none
Parameters:
Vectorbit vector to be expanded
NewNumBitsnew size of bit vector
Returns:
New expanded bit vector.
Note:
Exceptions: none
History: Fri Nov 16 10:11:16 1990, DSJ, Created.
void FreeBitVector ( BIT_VECTOR  BitVector)

This routine frees a bit vector. It also decrements the global counter that keeps track of the number of bit vectors allocated. If BitVector is NULL, then the count is printed to stderr.

Globals:

  • BitVectorCount count of number of bit vectors allocated
Parameters:
BitVectorbit vector to be freed
Note:
Exceptions: none
History: Tue Oct 23 16:46:09 1990, DSJ, Created.

int hamming_distance ( uinT32 array1,
uinT32 array2,
int  length 
)

hamming_distance(array1,array2,length) computes the hamming distance between two bit strings.

BIT_VECTOR NewBitVector ( int  NumBits)

Allocate and return a new bit vector large enough to hold the specified number of bits.

Globals:

  • BitVectorCount number of bit vectors allocated
Parameters:
NumBitsnumber of bits in new bit vector
Returns:
New bit vector.
Note:
Exceptions: none
History: Tue Oct 23 16:51:27 1990, DSJ, Created.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines