Skip to content

Commit

Permalink
Fixed type of bit vector
Browse files Browse the repository at this point in the history
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@237 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
theraysmith committed Jun 2, 2009
1 parent 7443d2f commit 880aa64
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions cutil/bitvec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
Include Files and Type Defines
----------------------------------------------------------------------------**/
#include "bitvec.h"
#include "emalloc.h"
#include "freelist.h"
#include "callcpp.h"

#include <stdio.h>

#include "emalloc.h"
#include "freelist.h"
#include "tprintf.h"

/**----------------------------------------------------------------------------
Global Data Definitions and Declarations
----------------------------------------------------------------------------**/
Expand All @@ -35,7 +36,7 @@ static int BitVectorCount = 0;
Public Code
----------------------------------------------------------------------------**/
/*---------------------------------------------------------------------------*/
BIT_VECTOR ExpandBitVector(BIT_VECTOR Vector, int NewNumBits) {
BIT_VECTOR ExpandBitVector(BIT_VECTOR Vector, int NewNumBits) {
/*
** Parameters:
** Vector bit vector to be expanded
Expand All @@ -47,15 +48,13 @@ BIT_VECTOR ExpandBitVector(BIT_VECTOR Vector, int NewNumBits) {
** Exceptions: none
** History: Fri Nov 16 10:11:16 1990, DSJ, Created.
*/
return ((BIT_VECTOR) Erealloc (Vector,
sizeof (unsigned long) *
WordsInVectorOfSize (NewNumBits)));

return ((BIT_VECTOR) Erealloc(Vector,
sizeof(Vector[0]) * WordsInVectorOfSize(NewNumBits)));
} /* ExpandBitVector */


/*---------------------------------------------------------------------------*/
void FreeBitVector(BIT_VECTOR BitVector) {
void FreeBitVector(BIT_VECTOR BitVector) {
/*
** Parameters:
** BitVector bit vector to be freed
Expand All @@ -70,24 +69,19 @@ void FreeBitVector(BIT_VECTOR BitVector) {
** History: Tue Oct 23 16:46:09 1990, DSJ, Created.
*/
if (BitVector) {
memfree(BitVector);
Efree(BitVector);
BitVectorCount--;
} else {
tprintf("%6d BITVECTOR elements in use\n", BitVectorCount);
}
else {
cprintf ("%6d BITVECTOR elements in use\n", BitVectorCount);
}

} /* FreeBitVector */


/*hamming_distance(array1,array2,length) computes the hamming distance
between two bit strings */
/*--------------------------------------------------------------------------*/
int hamming_distance( /*arrays to match */
register unsigned long *array1,
register unsigned long *array2,
register int length) { /*length of arrays */
register unsigned long diff; /*bit difference */
int hamming_distance(uinT32* array1, uinT32* array2, int length) {
register uinT32 diff; /*bit difference */
register int dist; /*total distance */

dist = 0;
Expand All @@ -103,7 +97,7 @@ int hamming_distance( /*arrays to match */


/*---------------------------------------------------------------------------*/
BIT_VECTOR NewBitVector(int NumBits) {
BIT_VECTOR NewBitVector(int NumBits) {
/*
** Parameters:
** NumBits number of bits in new bit vector
Expand All @@ -116,7 +110,6 @@ BIT_VECTOR NewBitVector(int NumBits) {
** History: Tue Oct 23 16:51:27 1990, DSJ, Created.
*/
BitVectorCount++;
return ((BIT_VECTOR) Emalloc (sizeof (unsigned long) *
WordsInVectorOfSize (NumBits)));

return ((BIT_VECTOR) Emalloc(sizeof(uinT32) *
WordsInVectorOfSize(NumBits)));
} /* NewBitVector */

0 comments on commit 880aa64

Please sign in to comment.