original_string: public static function fromBitString(BitString $bs, int $width): self
      {
          $num_bits = $bs->numBits();
          $num = gmp_import($bs->string(), 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
          $num >>= $bs->unusedBits();
          if ($num_bits < $width) {
              $num <<= ($width - $num_bits);
          }
          return new self(gmp_strval($num, 10), $width);
      }
code: public static function fromBitString(BitString $bs, int $width): self
      {
          $num_bits = $bs->numBits();
          $num = gmp_import($bs->string(), 1, GMP_MSW_FIRST | GMP_BIG_ENDIAN);
          $num >>= $bs->unusedBits();
          if ($num_bits < $width) {
              $num <<= ($width - $num_bits);
          }
          return new self(gmp_strval($num, 10), $width);
      }
code_tokens: public static function fromBitString ( BitString $ bs , int $ width ) : self { $ num_bits = $ bs -> numBits ( ) ; $ num = gmp_import ( $ bs -> string ( ) , 1 , GMP_MSW_FIRST | GMP_BIG_ENDIAN ) ; $ num >>= $ bs -> unusedBits ( ) ; if ( $ num_bits < $ width ) { $ num <<= ( $ width - $ num_bits ) ; } return new self ( gmp_strval ( $ num , 10 ) , $ width ) ; }
docstring: Initialize from BitString.
  
  @param BitString $bs
  @param int $width
  @return self
docstring_tokens: Initialize from BitString .