8ctopus / unsigned-int
将有符号整数转换为无符号整数
1.0.2
2023-12-28 11:57 UTC
Requires
- php: >=8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- nunomaduro/collision: ^6.2
- phpmd/phpmd: ^2.13
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5|^10.0
This package is auto-updated.
Last update: 2024-08-26 14:44:33 UTC
README
这是一个PHP库,用于将带符号整数转换为无符号整数。
PHP没有原生支持无符号整数,这可能导致在需要无符号整数时遇到一些麻烦。这个库希望使您的生活变得更加轻松。
安装和演示
composer require 8ctopus/unsigned-int
use Oct8pus\Unsigned\UInt8; use Oct8pus\Unsigned\UInt16; use Oct8pus\Unsigned\UInt32; require_once './vendor/autoload.php'; echo "convert signed int 8 to unsigned int 8\n"; echo (new UInt8(127)); echo (new UInt8(-128)); $uint8 = new UInt8(); $uint8->toUnsigned(127);
convert signed int 8 to unsigned int 8 127 > 0x7F (127) -128 > 0x80 (128)
测试
composer test
干净的代码
composer fix(-risky)