Skip to content

Commit

Permalink
Fixing a big-endian issue in SOP manipulation and factoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanminko committed Dec 22, 2024
1 parent 207cfdd commit 42c2c54
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/misc/mvc/mvcUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ int Mvc_CoverSetCubeSizes( Mvc_Cover_t * pCover )
int nBytes, nOnes;

// get the number of unsigned chars in the cube's bit strings
nBytes = pCover->nBits / (8 * sizeof(unsigned char)) + (int)(pCover->nBits % (8 * sizeof(unsigned char)) > 0);
// nBytes = pCover->nBits / (8 * sizeof(unsigned char)) + (int)(pCover->nBits % (8 * sizeof(unsigned char)) > 0);
nBytes = sizeof(Mvc_CubeWord_t) * pCover->nWords; // big-endian issue
// iterate through the cubes
Mvc_CoverForEachCube( pCover, pCube )
{
Expand All @@ -298,13 +299,14 @@ int Mvc_CoverSetCubeSizes( Mvc_Cover_t * pCover )
Synopsis [Counts the cube sizes.]
Description []
Description [This procedure works incorrectly on big-endian machines.]
SideEffects []
SeeAlso []
***********************************************************************/
/*
int Mvc_CoverGetCubeSize( Mvc_Cube_t * pCube )
{
unsigned char * pByte, * pByteStart, * pByteStop;
Expand All @@ -322,6 +324,7 @@ int Mvc_CoverGetCubeSize( Mvc_Cube_t * pCube )
nOnes += bit_count[*pByte];
return nOnes;
}
*/

/**Function*************************************************************
Expand Down Expand Up @@ -351,7 +354,8 @@ int Mvc_CoverCountCubePairDiffs( Mvc_Cover_t * pCover, unsigned char pDiffs[] )
// allocate a temporary mask
pMask = Mvc_CubeAlloc( pCover );
// get the number of unsigned chars in the cube's bit strings
nBytes = pCover->nBits / (8 * sizeof(unsigned char)) + (int)(pCover->nBits % (8 * sizeof(unsigned char)) > 0);
// nBytes = pCover->nBits / (8 * sizeof(unsigned char)) + (int)(pCover->nBits % (8 * sizeof(unsigned char)) > 0);
nBytes = sizeof(Mvc_CubeWord_t) * pCover->nWords; // big-endian issue
// iterate through the cubes
nCubePairs = 0;
Mvc_CoverForEachCube( pCover, pCube1 )
Expand Down

0 comments on commit 42c2c54

Please sign in to comment.