Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit fc0f1d9

Browse files
author
Jonathan Kliem
committed
resolve slow down comparison
1 parent 4362e2c commit fc0f1d9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/sage/data_structures/bitset_intrinsics.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,26 @@ static inline int _bitset_cmp(mp_limb_t* a, mp_limb_t* b, mp_bitcnt_t limbs, enu
175175
if (!cmp_on_chunk(A, B, cmpop))
176176
return 0;
177177
}
178+
for(i; i < limbs; i++){
179+
if (!cmp_on_limb(a[i], b[i], cmpop))
180+
return 0;
181+
}
182+
return 1;
178183
#elif __SSE4_1__
179184
for(i; i + (2*LIMBS_PER_64 - 1) < limbs; i +=2*LIMBS_PER_64){
180185
__m128i A = _mm_loadu_si128((const __m128i*)&a[i]);
181186
__m128i B = _mm_loadu_si128((const __m128i*)&b[i]);
182187
if (!cmp_on_chunk(A, B, cmpop))
183188
return 0;
184189
}
190+
for(i; i < limbs; i++){
191+
if (!cmp_on_limb(a[i], b[i], cmpop))
192+
return 0;
193+
}
194+
return 1;
195+
#else
196+
return cmp_with_mpn(a, b, limbs, cmpop);
185197
#endif
186-
return cmp_with_mpn(a + i, b + i, limbs - i, cmpop);
187198
}
188199

189200
static inline int _sparse_bitset_cmp(mp_limb_t* a, mp_bitcnt_t* a_non_zero_chunks, mp_bitcnt_t a_n_non_zero_chunks, mp_limb_t* b, enum cmpop_t cmpop){

0 commit comments

Comments
 (0)