Skip to content

Commit

Permalink
Lab: core_bound/vectorization_2
Browse files Browse the repository at this point in the history
  • Loading branch information
stankevichevg committed Nov 24, 2024
1 parent dc6a1b2 commit 9043f41
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions labs/core_bound/vectorization_2/solution.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#include "solution.hpp"

uint16_t checksum(const Blob &blob) {
uint16_t acc = 0;
uint32_t acc = 0;
for (auto value : blob) {
acc += value;
acc += acc < value; // add carry
}
while (acc >> 16) {
acc = (acc & 0xFFFF) + (acc >> 16);
}
return acc;
}
}

0 comments on commit 9043f41

Please sign in to comment.