Permalink
Browse files

Fix 32-bit build and cleanups

  • Loading branch information...
catid committed Apr 18, 2018
1 parent bdaf95a commit 575b072b11afc6b9a9855ba05cbbb6fb9f4f1c9f
Showing with 11 additions and 9 deletions.
  1. +5 −5 WirehairCodec.cpp
  2. +6 −4 WirehairTools.cpp
View
@@ -910,8 +910,8 @@ void Codec::MultiplyDenseRows()
} // next column
}
// This matrix is generated by HeavyRowGenerator.cpp
// It has a special quality that stacked random binary matrices do not affect
// This Cauchy matrix is generated by HeavyRowGenerator.cpp
// 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
// common property for Cauchy matrices, and I didn't know this was possible.
static const uint8_t kHeavyMatrix[kHeavyRows][kHeavyCols] = {
@@ -3618,7 +3618,7 @@ bool Codec::AllocateInput()
FreeInput();
// Allocate input blocks
_input_blocks = SIMDSafeAllocate(sizeBytes);
_input_blocks = SIMDSafeAllocate((size_t)sizeBytes);
if (!_input_blocks) {
return false;
}
@@ -3677,7 +3677,7 @@ bool Codec::AllocateMatrix()
{
FreeMatrix();
uint8_t * GF256_RESTRICT matrix = SIMDSafeAllocate(sizeBytes);
uint8_t * GF256_RESTRICT matrix = SIMDSafeAllocate((size_t)sizeBytes);
if (!matrix) {
return false;
}
@@ -3763,7 +3763,7 @@ bool Codec::AllocateWorkspace()
FreeWorkspace();
// Allocate workspace
_recovery_blocks = SIMDSafeAllocate(sizeBytes);
_recovery_blocks = SIMDSafeAllocate((size_t)sizeBytes);
if (!_recovery_blocks) {
return false;
}
View
@@ -234,7 +234,9 @@ uint16_t NextPrime16(uint16_t n)
This is generated and unit tested in TableGenerator.cpp
*/
static const unsigned kMatrixSeedCount = 512;
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,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,
@@ -832,7 +834,7 @@ static const DensePoint kDensePoints[kDensePointCount] = {
};
/// Interpolate between two values of N and corresponding counts.
/// It works for Count1 < Count 0.
/// It works for Count1 < Count0
static uint16_t LinearInterpolate(
int N0, int N1,
int Count0, int Count1,
@@ -870,7 +872,7 @@ uint16_t GetDenseCount(unsigned N)
lowPoint.DenseCount = 35;
highPoint.DenseCount = 48;
}
else // if (N <= 2048)
else // if (N < 2048)
{
lowPoint.N = 1000;
highPoint.N = 2048;
@@ -892,9 +894,9 @@ uint16_t GetDenseCount(unsigned N)
break;
}
const DensePoint point = kDensePoints[mid];
const DensePoint midPoint = kDensePoints[mid];
if (N > point.N) {
if (N > midPoint.N) {
low = mid;
}
else {

0 comments on commit 575b072

Please sign in to comment.