Loading docs/index.rst +7 −7 Original line number Diff line number Diff line Loading @@ -155,8 +155,8 @@ Large integers These math libraries are not explicit dependencies of this library. Install them separately before enabling. By default the library works with a native integer type but if you need to use large integers, for example if you try to parse a torrent file for a >= 4GB file on a 32 bit system, By default the library only works with a native integer type but if you need to use large integers, for example, if you try to parse a torrent file for a >= 4GB file on a 32 bit system, you can enable big integer support. Versions 1.5 and 2.5 added support for GMP_: Loading Loading @@ -189,20 +189,20 @@ Versions 1.6 and 2.6 added support for `brick/math`_ and Math_BigInteger_, and c // brick/math $data = Bencode::decode( "d3:gmpi79228162514264337593543950336ee", "d3:inti79228162514264337593543950336ee", ['bigInt' => Bencode\BigInt::BRICK_MATH] ]; // ['int' => \Brick\Math\BigInteger::of('79228162514264337593543950336')] // Math_BigInteger from PEAR $data = Bencode::decode( "d3:gmpi79228162514264337593543950336ee", "d3:inti79228162514264337593543950336ee", ['bigInt' => Bencode\BigInt::PEAR] ]; // ['int' => new \Math_BigInteger('79228162514264337593543950336')] // Internal BigIntType class // does not require any external dependencies but also does not allow any manipulation $data = Bencode::decode( "d3:gmpi79228162514264337593543950336ee", "d3:inti79228162514264337593543950336ee", ['bigInt' => Bencode\BigInt::INTERNAL] ]; // ['int' => new \SandFox\Bencode\Types\BigIntType('79228162514264337593543950336')] // BigIntType is a value object with several getters: Loading @@ -215,11 +215,11 @@ Versions 1.6 and 2.6 added support for `brick/math`_ and Math_BigInteger_, and c // like listType and dictType you can use a callable or a class name $data = Bencode::decode( "d3:gmpi79228162514264337593543950336ee", "d3:inti79228162514264337593543950336ee", ['bigInt' => fn($v) => v] ]; // ['int' => '79228162514264337593543950336'] $data = Bencode::decode( "d3:gmpi79228162514264337593543950336ee", "d3:inti79228162514264337593543950336ee", ['bigInt' => MyBigIntHandler::class] ]; // ['int' => new MyBigIntHandler('79228162514264337593543950336')]] Loading Loading
docs/index.rst +7 −7 Original line number Diff line number Diff line Loading @@ -155,8 +155,8 @@ Large integers These math libraries are not explicit dependencies of this library. Install them separately before enabling. By default the library works with a native integer type but if you need to use large integers, for example if you try to parse a torrent file for a >= 4GB file on a 32 bit system, By default the library only works with a native integer type but if you need to use large integers, for example, if you try to parse a torrent file for a >= 4GB file on a 32 bit system, you can enable big integer support. Versions 1.5 and 2.5 added support for GMP_: Loading Loading @@ -189,20 +189,20 @@ Versions 1.6 and 2.6 added support for `brick/math`_ and Math_BigInteger_, and c // brick/math $data = Bencode::decode( "d3:gmpi79228162514264337593543950336ee", "d3:inti79228162514264337593543950336ee", ['bigInt' => Bencode\BigInt::BRICK_MATH] ]; // ['int' => \Brick\Math\BigInteger::of('79228162514264337593543950336')] // Math_BigInteger from PEAR $data = Bencode::decode( "d3:gmpi79228162514264337593543950336ee", "d3:inti79228162514264337593543950336ee", ['bigInt' => Bencode\BigInt::PEAR] ]; // ['int' => new \Math_BigInteger('79228162514264337593543950336')] // Internal BigIntType class // does not require any external dependencies but also does not allow any manipulation $data = Bencode::decode( "d3:gmpi79228162514264337593543950336ee", "d3:inti79228162514264337593543950336ee", ['bigInt' => Bencode\BigInt::INTERNAL] ]; // ['int' => new \SandFox\Bencode\Types\BigIntType('79228162514264337593543950336')] // BigIntType is a value object with several getters: Loading @@ -215,11 +215,11 @@ Versions 1.6 and 2.6 added support for `brick/math`_ and Math_BigInteger_, and c // like listType and dictType you can use a callable or a class name $data = Bencode::decode( "d3:gmpi79228162514264337593543950336ee", "d3:inti79228162514264337593543950336ee", ['bigInt' => fn($v) => v] ]; // ['int' => '79228162514264337593543950336'] $data = Bencode::decode( "d3:gmpi79228162514264337593543950336ee", "d3:inti79228162514264337593543950336ee", ['bigInt' => MyBigIntHandler::class] ]; // ['int' => new MyBigIntHandler('79228162514264337593543950336')]] Loading