Skip to content

Commit

Permalink
BitStreamer::getInput(): add branch likelyhood annotations
Browse files Browse the repository at this point in the history
```
OVERALL_GEOMEAN                                                                                                                    -0.0182         -0.0156             0             0             0             0

```
  • Loading branch information
LebedevRI committed Mar 29, 2024
1 parent 77c44c3 commit 442ae3c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librawspeed/bitstreams/BitStreamer.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ struct BitStreamerForwardSequentialReplenisher final
// Do we have BitStreamerTraits<Tag>::MaxProcessBytes or more bytes left in
// the input buffer? If so, then we can just read from said buffer.
if (getPos() + BitStreamerTraits<Tag>::MaxProcessBytes <=
Base::input.size()) {
Base::input.size()) [[likely]] {
return Base::input
.getCrop(getPos(), BitStreamerTraits<Tag>::MaxProcessBytes)
.getAsArray1DRef();
Expand All @@ -119,8 +119,8 @@ struct BitStreamerForwardSequentialReplenisher final

// Note that in order to keep all fill-level invariants we must allow to
// over-read past-the-end a bit.
if (getPos() >
Base::input.size() + 2 * BitStreamerTraits<Tag>::MaxProcessBytes)
if (getPos() > Base::input.size() +
2 * BitStreamerTraits<Tag>::MaxProcessBytes) [[unlikely]]
ThrowIOE("Buffer overflow read in BitStreamer");

variableLengthLoadNaiveViaMemcpy(Base::tmp(), Base::input, getPos());
Expand Down

0 comments on commit 442ae3c

Please sign in to comment.