Navigation Menu

Skip to content

Commit

Permalink
Fix 32-bit build and cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
catid committed Apr 18, 2018
1 parent bdaf95a commit 575b072
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions WirehairCodec.cpp
Expand Up @@ -910,8 +910,8 @@ void Codec::MultiplyDenseRows()
} // next column } // next column
} }


// This matrix is generated by HeavyRowGenerator.cpp // This Cauchy matrix is generated by HeavyRowGenerator.cpp
// It has a special quality that stacked random binary matrices do not affect // It has a special property that stacked random binary matrices do not affect
// its inversion rate. Honestly I haven't looked into why, but it's not a // its inversion rate. Honestly I haven't looked into why, but it's not a
// common property for Cauchy matrices, and I didn't know this was possible. // common property for Cauchy matrices, and I didn't know this was possible.
static const uint8_t kHeavyMatrix[kHeavyRows][kHeavyCols] = { static const uint8_t kHeavyMatrix[kHeavyRows][kHeavyCols] = {
Expand Down Expand Up @@ -3618,7 +3618,7 @@ bool Codec::AllocateInput()
FreeInput(); FreeInput();


// Allocate input blocks // Allocate input blocks
_input_blocks = SIMDSafeAllocate(sizeBytes); _input_blocks = SIMDSafeAllocate((size_t)sizeBytes);
if (!_input_blocks) { if (!_input_blocks) {
return false; return false;
} }
Expand Down Expand Up @@ -3677,7 +3677,7 @@ bool Codec::AllocateMatrix()
{ {
FreeMatrix(); FreeMatrix();


uint8_t * GF256_RESTRICT matrix = SIMDSafeAllocate(sizeBytes); uint8_t * GF256_RESTRICT matrix = SIMDSafeAllocate((size_t)sizeBytes);
if (!matrix) { if (!matrix) {
return false; return false;
} }
Expand Down Expand Up @@ -3763,7 +3763,7 @@ bool Codec::AllocateWorkspace()
FreeWorkspace(); FreeWorkspace();


// Allocate workspace // Allocate workspace
_recovery_blocks = SIMDSafeAllocate(sizeBytes); _recovery_blocks = SIMDSafeAllocate((size_t)sizeBytes);
if (!_recovery_blocks) { if (!_recovery_blocks) {
return false; return false;
} }
Expand Down
10 changes: 6 additions & 4 deletions WirehairTools.cpp
Expand Up @@ -234,7 +234,9 @@ uint16_t NextPrime16(uint16_t n)
This is generated and unit tested in TableGenerator.cpp This is generated and unit tested in TableGenerator.cpp
*/ */

static const unsigned kMatrixSeedCount = 512; static const unsigned kMatrixSeedCount = 512;

static const uint8_t kInvertibleMatrixSeeds[kMatrixSeedCount] = { static const uint8_t kInvertibleMatrixSeeds[kMatrixSeedCount] = {
0,1,4,2,0,12,0,1,1,0,2,2,1,4,1,1,1,9,9,1,0,0,0,0,2,2,2,4,3,4,1,1, 0,1,4,2,0,12,0,1,1,0,2,2,1,4,1,1,1,9,9,1,0,0,0,0,2,2,2,4,3,4,1,1,
0,0,0,0,7,1,6,2,5,1,0,4,0,0,10,0,11,3,3,2,10,0,0,0,0,0,0,1,0,0,1,6, 0,0,0,0,7,1,6,2,5,1,0,4,0,0,10,0,11,3,3,2,10,0,0,0,0,0,0,1,0,0,1,6,
Expand Down Expand Up @@ -832,7 +834,7 @@ static const DensePoint kDensePoints[kDensePointCount] = {
}; };


/// Interpolate between two values of N and corresponding counts. /// Interpolate between two values of N and corresponding counts.
/// It works for Count1 < Count 0. /// It works for Count1 < Count0
static uint16_t LinearInterpolate( static uint16_t LinearInterpolate(
int N0, int N1, int N0, int N1,
int Count0, int Count1, int Count0, int Count1,
Expand Down Expand Up @@ -870,7 +872,7 @@ uint16_t GetDenseCount(unsigned N)
lowPoint.DenseCount = 35; lowPoint.DenseCount = 35;
highPoint.DenseCount = 48; highPoint.DenseCount = 48;
} }
else // if (N <= 2048) else // if (N < 2048)
{ {
lowPoint.N = 1000; lowPoint.N = 1000;
highPoint.N = 2048; highPoint.N = 2048;
Expand All @@ -892,9 +894,9 @@ uint16_t GetDenseCount(unsigned N)
break; break;
} }


const DensePoint point = kDensePoints[mid]; const DensePoint midPoint = kDensePoints[mid];


if (N > point.N) { if (N > midPoint.N) {
low = mid; low = mid;
} }
else { else {
Expand Down

0 comments on commit 575b072

Please sign in to comment.