Skip to content

Commit 2dab1bb

Browse files
committed
Check at compile time what can be checked there
1 parent f6a679e commit 2dab1bb

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

SerialPrograms/Source/Kernels/ScaleInvariantMatrixMatch/Kernels_ScaleInvariantMatrixMatch_Routines.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct SumATA2{
3939
vtype sum_at2 = Context::vzero();
4040
vtype sum_at3 = Context::vzero();
4141

42-
if (VECTOR_LENGTH > 1){
42+
if constexpr (VECTOR_LENGTH > 1){
4343
size_t align = (size_t)T % (VECTOR_LENGTH * sizeof(float));
4444
if (align){
4545
align /= sizeof(float);
@@ -95,11 +95,13 @@ struct SumATA2{
9595
ptrT += 1;
9696
length -= VECTOR_LENGTH;
9797
}
98-
if (VECTOR_LENGTH > 1 && length){
99-
vtype a0, t0;
100-
Context::load2_partial_front(length, a0, ptrT, t0, ptrA);
101-
sum_at0 = Context::vpma(a0, t0, sum_at0);
102-
sum_as0 = Context::vpma(a0, a0, sum_as0);
98+
if constexpr (VECTOR_LENGTH > 1){
99+
if (length){
100+
vtype a0, t0;
101+
Context::load2_partial_front(length, a0, ptrT, t0, ptrA);
102+
sum_at0 = Context::vpma(a0, t0, sum_at0);
103+
sum_as0 = Context::vpma(a0, a0, sum_as0);
104+
}
103105
}
104106

105107
sum_A2 = Context::vadd(sum_A2, sum_as0);
@@ -115,7 +117,7 @@ struct SumATA2{
115117
vtype sum_at2 = Context::vzero();
116118
vtype sum_at3 = Context::vzero();
117119

118-
if (VECTOR_LENGTH > 1){
120+
if constexpr (VECTOR_LENGTH > 1){
119121
size_t align = (size_t)TW % (VECTOR_LENGTH * sizeof(float));
120122
if (align){
121123
align /= sizeof(float);
@@ -219,7 +221,7 @@ struct SumError{
219221
vtype sum2 = Context::vzero();
220222
vtype sum3 = Context::vzero();
221223

222-
if (VECTOR_LENGTH > 1){
224+
if constexpr (VECTOR_LENGTH > 1){
223225
size_t align = (size_t)T % (VECTOR_LENGTH * sizeof(float));
224226
if (align){
225227
align /= sizeof(float);
@@ -282,7 +284,7 @@ struct SumError{
282284
vtype sum2 = Context::vzero();
283285
vtype sum3 = Context::vzero();
284286

285-
if (VECTOR_LENGTH > 1){
287+
if constexpr (VECTOR_LENGTH > 1){
286288
size_t align = (size_t)TW % (VECTOR_LENGTH * sizeof(float));
287289
if (align){
288290
align /= sizeof(float);

0 commit comments

Comments
 (0)