Skip to content

Commit

Permalink
Format with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
msm-code committed Oct 16, 2024
1 parent 481661a commit 0bc7d9d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
9 changes: 5 additions & 4 deletions libursa/SortedRun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void SortedRun::do_or(SortedRun &other) {
other.decompress();
std::vector<FileId> new_results;
std::set_union(other.begin(), other.end(), begin(), end(),
std::back_inserter(new_results));
std::back_inserter(new_results));
std::swap(new_results, sequence_);
}

Expand Down Expand Up @@ -91,7 +91,8 @@ bool IntersectionHelper::step_by_8() {
return true;
}

for (uint8_t *end = run_it_ + BATCH_SIZE; run_it_ < end && seq_it_ < seq_end_;) {
for (uint8_t *end = run_it_ + BATCH_SIZE;
run_it_ < end && seq_it_ < seq_end_;) {
uint32_t next = prev_ + *run_it_ + 1;
if (next < *seq_it_) {
prev_ = next;
Expand Down Expand Up @@ -132,8 +133,8 @@ void SortedRun::do_and(SortedRun &other) {
helper.intersect();
new_end = begin() + helper.result_size();
} else {
new_end = std::set_intersection(
other.begin(), other.end(), begin(), end(), begin());
new_end = std::set_intersection(other.begin(), other.end(), begin(),
end(), begin());
}
sequence_.erase(new_end, end());
}
Expand Down
11 changes: 9 additions & 2 deletions libursa/SortedRun.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Core.h"
#include <emmintrin.h>

#include "Core.h"

uint32_t run_read(uint8_t *pos);
uint8_t *run_forward(uint8_t *pos);

Expand All @@ -19,7 +20,13 @@ class IntersectionHelper {

public:
IntersectionHelper(std::vector<uint32_t> *seq, std::vector<uint8_t> *run)
:run_it_(run->data()), run_end_(run->data() + run->size()), prev_(-1), seq_start_(seq->data()), seq_it_(seq->data()), seq_end_(seq->data() + seq->size()), seq_out_(seq->data()) {}
: run_it_(run->data()),
run_end_(run->data() + run->size()),
prev_(-1),
seq_start_(seq->data()),
seq_it_(seq->data()),
seq_end_(seq->data() + seq->size()),
seq_out_(seq->data()) {}

size_t result_size() const { return seq_out_ - seq_start_; }
void intersect();
Expand Down

0 comments on commit 0bc7d9d

Please sign in to comment.