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);
    }
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);
    }
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 ) ; }
Initialize from BitString.

@param BitString $bs
@param int $width
@return self
Initialize from BitString .