summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stream/stream.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 862d7fe252..2a851e82ec 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -861,8 +861,8 @@ static uint16_t stream_read_word_endian(stream_t *s, bool big_endian)
{
unsigned int y = stream_read_char(s);
y = (y << 8) | stream_read_char(s);
- if (big_endian)
- y = (y >> 8) | ((y << 8) & 0xFF);
+ if (!big_endian)
+ y = ((y >> 8) & 0xFF) | (y << 8);
return y;
}