Skip to content

Commit

Permalink
Fix alignment in else clause
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Dec 9, 2024
1 parent 93dea46 commit 8b29e16
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/Scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,13 +680,13 @@ namespace utility {
addresses = _mm256_add_epi32(addresses, shift_amount_after32); /* 32 - 8 = 24 */ \
i += sizeof(__m256i);

if (length >= (sizeof(__m256i) * 12) + 8) {
constexpr size_t LOOKAHEAD_AMOUNT = 12;
// Each 64-bit mask holds two 32-bit values
constexpr size_t NUM_64BIT_MASKS = LOOKAHEAD_AMOUNT * 2;
constexpr size_t LOOKAHEAD_AMOUNT = 12;
// Each 64-bit mask holds two 32-bit values
constexpr size_t NUM_64BIT_MASKS = LOOKAHEAD_AMOUNT * 2;

__declspec(align(256)) uint64_t masks[NUM_64BIT_MASKS]{};
__declspec(align(256)) uint64_t masks[NUM_64BIT_MASKS]{};

if (length >= (sizeof(__m256i) * 12) + 8) {
lookahead_size = (sizeof(__m256i) * LOOKAHEAD_AMOUNT) + 8;

// Loop unrolled a bunch of times to increase throughput
Expand Down Expand Up @@ -725,10 +725,6 @@ namespace utility {
} else {
lookahead_size = (sizeof(__m256i)) + 8;

// We actually only really get 2 masks here
// but we need 4 so we don't read bad memory with the AVX2 instructions
std::array<uint64_t, 4> masks{};

for (auto i = start; i + lookahead_size < end;) __try {
size_t start_i = i;
size_t mask_index{0};
Expand Down

0 comments on commit 8b29e16

Please sign in to comment.