8ctopus/unsigned-int

Convert signed integers to unsigned

1.0.2 2023-12-28 11:57 UTC

This package is auto-updated.

Last update: 2024-04-28 12:46:48 UTC


README

packagist downloads min php version license tests code coverage badge lines of code

A php library to convert signed integers to unsigned int.

php does not implement unsigned integers natively which can cause some headaches when unsigned are required. This library hopes to make your life a lot easier.

install and demo

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)

tests

composer test

clean code

composer fix(-risky)