aboutsummaryrefslogtreecommitdiffstats
path: root/includes/media/DjVuImage.php
diff options
context:
space:
mode:
authorThiemo Kreuz <thiemo.kreuz@wikimedia.de>2019-05-17 16:57:23 +0200
committerThiemo Kreuz <thiemo.kreuz@wikimedia.de>2019-05-17 16:57:23 +0200
commit65c42a6034e810505a2c2481c73c2fa04a45a659 (patch)
tree3190bcb8b7909927e5832dc5354cd53c2702379f /includes/media/DjVuImage.php
parent48f1bf98a2a205ee82e942cc1316c788f6f25a56 (diff)
downloadmediawikicore-65c42a6034e810505a2c2481c73c2fa04a45a659.tar.gz
mediawikicore-65c42a6034e810505a2c2481c73c2fa04a45a659.zip
Simplify a few binary checks for bit 1
( $var & 1 ) is either 0 or 1, which can be used as a boolean value. The main advantage of this is that there is no confusion with the operator precedence. In `$var & 1 !== 1` the `!==` is executed first, effectively turning it into `$var & 0`. This always succeeds. Change-Id: I53c81a3891d42b2660eefc311f1f0f2523104894
Diffstat (limited to 'includes/media/DjVuImage.php')
-rw-r--r--includes/media/DjVuImage.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/includes/media/DjVuImage.php b/includes/media/DjVuImage.php
index fde43f404b6c..13a39edcf263 100644
--- a/includes/media/DjVuImage.php
+++ b/includes/media/DjVuImage.php
@@ -111,7 +111,7 @@ class DjVuImage {
$this->dumpForm( $file, $chunkLength, $indent + 1 );
} else {
fseek( $file, $chunkLength, SEEK_CUR );
- if ( ( $chunkLength & 1 ) == 1 ) {
+ if ( $chunkLength & 1 ) {
// Padding byte between chunks
fseek( $file, 1, SEEK_CUR );
}
@@ -169,7 +169,7 @@ class DjVuImage {
private function skipChunk( $file, $chunkLength ) {
fseek( $file, $chunkLength, SEEK_CUR );
- if ( ( $chunkLength & 0x01 ) == 1 && !feof( $file ) ) {
+ if ( ( $chunkLength & 1 ) && !feof( $file ) ) {
// padding byte
fseek( $file, 1, SEEK_CUR );
}