File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -275,11 +275,14 @@ private function doCountBin()
275275 }
276276
277277 $ ord = \ord ($ bitset [$ bytePos ]);
278- for ($ bitPos = 0 ; $ bitPos < 8 ; ++$ bitPos ) {
279- if ($ ord & (1 << $ bitPos )) {
280- ++$ count ;
281- }
282- }
278+ if ($ ord & 0b00000001 ) ++$ count ;
279+ if ($ ord & 0b00000010 ) ++$ count ;
280+ if ($ ord & 0b00000100 ) ++$ count ;
281+ if ($ ord & 0b00001000 ) ++$ count ;
282+ if ($ ord & 0b00010000 ) ++$ count ;
283+ if ($ ord & 0b00100000 ) ++$ count ;
284+ if ($ ord & 0b01000000 ) ++$ count ;
285+ if ($ ord & 0b10000000 ) ++$ count ;
283286 }
284287 return $ count ;
285288 }
@@ -305,8 +308,8 @@ private function doCountInt()
305308 }
306309
307310 // iterate byte by byte and count set bits
308- for ( $ i = 0 ; $ i < \PHP_INT_SIZE ; ++ $ i ) {
309- $ bitPos = $ i * 8 ;
311+ $ phpIntBitSize = \PHP_INT_SIZE * 8 ;
312+ for ( $ bitPos = 0 ; $ bitPos < $ phpIntBitSize ; $ bitPos += 8 ) {
310313 $ bitChk = 0xff << $ bitPos ;
311314 $ byte = $ bitset & $ bitChk ;
312315 if ($ byte ) {
You can’t perform that action at this time.
0 commit comments