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);
    }