Skip to content

Commit

Permalink
For some reason this is faster
Browse files Browse the repository at this point in the history
  • Loading branch information
msm-code committed Oct 6, 2024
1 parent 525af8b commit c11ee25
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libursa/SortedRun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ uint32_t RunIterator::current() const {
acc += (next & 0x7FU) << shift;
shift += 7U;
if ((next & 0x80U) == 0) {
return curr_ + acc + 1;
return prev_ + acc + 1;
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions libursa/SortedRun.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
class RunIterator : public std::iterator<std::forward_iterator_tag, uint32_t> {
typedef RunIterator iterator;
uint8_t *pos_;
int32_t curr_;
int32_t prev_;

uint32_t current() const;
uint8_t *nextpos();

public:
RunIterator(uint8_t *run) : pos_(run), curr_(-1) { curr_ = current(); }
RunIterator(uint8_t *run) : pos_(run), prev_(-1) { }
~RunIterator() {}

RunIterator &operator++() {
prev_ = current();
pos_ = nextpos();
curr_ = current();
return *this;
}

uint32_t operator*() const { return curr_; }
uint32_t operator*() const { return current(); }
bool operator!=(const iterator &rhs) const { return pos_ != rhs.pos_; }
};

Expand Down
2 changes: 1 addition & 1 deletion libursa/Version.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ constexpr std::string_view ursadb_format_version = "1.5.0";
// Project version.
// Consider updating the version tag when doing PRs.
// clang-format off
constexpr std::string_view ursadb_version_string = "@PROJECT_VERSION@+opt7";
constexpr std::string_view ursadb_version_string = "@PROJECT_VERSION@+opt8";
// clang-format on

0 comments on commit c11ee25

Please sign in to comment.