Skip to content

Bug with >> on some php version #2

@emeric0101

Description

@emeric0101

Hi, i have a fix to suggest :
In the function mx(), in my server, i had an issue with right byte shifting in $y >> 3 because it returned negative values.
For fixting it : (from http://stackoverflow.com/questions/2642026/php-equivalent-javascript-shift-right-with-zero-fill-bitwise-operators )

private static function rightShift($x, $c)
          {
              $x = intval ($x); // Because 13.5 >> 0 returns 13. We follow.
              $nmaxBits = PHP_INT_SIZE * 8;
              $c %= $nmaxBits;
              if ($c)
                  return $x >> $c & ~ (-1 << $nmaxBits - $c);
              else
                  return $x;
          }

then replace eveywhere you use x << y

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions