Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7a93396

Browse files
committed
Tweaked C++ BitInputStream class in case EOF is not -1.
1 parent f6744d9 commit 7a93396

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎cpp/BitIoStream.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ BitInputStream::BitInputStream(std::istream &in) :
1818

1919

2020
int BitInputStream::read() {
21-
if (currentByte == -1)
21+
if (currentByte == EOF)
2222
return -1;
2323
if (numBitsRemaining == 0) {
2424
currentByte = input.get(); // Note: istream.get() returns int, not char

‎cpp/BitIoStream.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class BitInputStream final {
2323
// The underlying byte stream to read from.
2424
private: std::istream &input;
2525

26-
// Either in the range [0x00, 0xFF] if bits are available, or -1 if end of stream is reached.
26+
// Either in the range [0x00, 0xFF] if bits are available, or EOF if end of stream is reached.
2727
private: int currentByte;
2828

2929
// Number of remaining bits in the current byte, always between 0 and 7 (inclusive).

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /