Skip to content

Commit e237a38

Browse files
committed
Add const attributes to IntSimMatrix multiplier
IntSimMatrix no longer contains variable members. Signed-off-by: Stefan Weil <[email protected]>
1 parent 7c70147 commit e237a38

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

src/arch/intsimdmatrix.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ namespace tesseract {
2828
// Factory makes and returns an IntSimdMatrix (sub)class of the best
2929
// available type for the current architecture.
3030
/* static */
31-
IntSimdMatrix* IntSimdMatrix::GetFastestMultiplier() {
32-
IntSimdMatrix* multiplier;
31+
const IntSimdMatrix* IntSimdMatrix::GetFastestMultiplier() {
32+
const IntSimdMatrix* multiplier;
3333
if (SIMDDetect::IsAVX2Available()) {
3434
multiplier = new IntSimdMatrixAVX2();
3535
} else if (SIMDDetect::IsSSEAvailable()) {

src/arch/intsimdmatrix.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class IntSimdMatrix {
7171

7272
// Factory makes and returns an IntSimdMatrix (sub)class of the best
7373
// available type for the current architecture.
74-
static IntSimdMatrix* GetFastestMultiplier();
74+
static const IntSimdMatrix* GetFastestMultiplier();
7575

7676
// Computes a reshaped copy of the weight matrix w. If there are no
7777
// partial_funcs_, it does nothing.

src/lstm/networkio.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const float kMinProb = exp(kMinCertainty);
3434
// Holds the optimal integer multiplier for this machine.
3535
// This is a leaked, lazily initialized singleton, and is used for computing
3636
// padding to apply to i_ for SIMD use.
37-
IntSimdMatrix* NetworkIO::multiplier_ = nullptr;
37+
const IntSimdMatrix* NetworkIO::multiplier_ = nullptr;
3838

3939
// Resizes to a specific size as a 2-d temp buffer. No batches, no y-dim.
4040
void NetworkIO::Resize2d(bool int_mode, int width, int num_features) {

src/lstm/networkio.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class NetworkIO {
341341
// Holds the optimal integer multiplier for this machine.
342342
// This is a leaked, lazily initialized singleton, and is used for computing
343343
// padding to apply to i_ for SIMD use.
344-
static IntSimdMatrix* multiplier_;
344+
static const IntSimdMatrix* multiplier_;
345345
};
346346

347347
} // namespace tesseract.

src/lstm/weightmatrix.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class WeightMatrix {
179179
// The weights matrix reorganized in whatever way suits this instance.
180180
std::vector<int8_t> shaped_w_;
181181
// Holds the optimal integer multiplier for this machine.
182-
std::unique_ptr<IntSimdMatrix> multiplier_;
182+
std::unique_ptr<const IntSimdMatrix> multiplier_;
183183
};
184184

185185
} // namespace tesseract.

0 commit comments

Comments
 (0)