arokettu / unsigned
固定长度无符号算术仿真
1.3.5
2024-02-01 20:40 UTC
Requires
- php: ^7.0 | ^8.0
Requires (Dev)
- phpunit/phpunit: >= 6.5 <10
- psy/psysh: *
- sandfox.dev/code-standard: ^1.2023.12.09
- squizlabs/php_codesniffer: *
README
PHP的固定长度无符号算术仿真。该库作为random-polyfill的辅助工具创建。
安装
composer require 'arokettu/unsigned'
示例
<?php use Arokettu\Unsigned as u; $a = u\from_int(1234567890123456789, 24); // use 24-byte a.k.a. 192-bit arithmetic $b = u\from_hex('123456789abcdef01234567890abcdef', 24); // numbers must have same bitness // 1234567890123456789 * 0x123456789abcdef01234567890abcdef = $c = u\mul($a, $b); var_dump(u\to_dec($c)); // 29873897512945703720213152879288233401251320475301467035
文档
完整文档请在此处查看:https://sandfox.dev/php/unsigned.html
也可在Read the Docs上查看:https://php-unsigned.readthedocs.io/
支持
请在GitLab的主仓库中提交问题:https://gitlab.com/sandfox/unsigned/-/issues
在Gitter的房间中随时提问:https://gitter.im/arokettu/community
许可证
该库在2-Clause BSD许可证的条款下作为开源软件提供。