Example #1
0
<?php

/*
function __autoload($class) {
	$fileName = '';
	for($character = 0; $character < strlen($class); $character++) {
		if((strtoupper(substr($class, $character, 1)) == substr($class, $character, 1)) && $character > 0) {
			$fileName .= '_';
		}
		
		$fileName .= strtolower(substr($class, $character, 1));
	}
	
	include_once($fileName . '.php');
}*/
require_once 'src/WriteStream.php';
require_once 'src/ReadStream.php';
require_once 'src/RangeEncoder.php';
require_once 'src/RangeDecoder.php';
require_once 'src/CompressionStream.php';
require_once 'src/Order0Model.php';
require_once 'src/DecompressionStream.php';
require_once 'src/UInt128.php';
$i = new UInt128('12345');
echo $i->add('54321');
Example #2
0
 public function powerSelf(UInt128 $exponent)
 {
     if ($exponent->compareTo(new UInt128(0)) == 0) {
         for ($currentDigit = 0; $currentDigit < 16; $currentDigit++) {
             $this->digits[$currentDigit] = $currentDigit == 0 ? 1 : 0;
         }
     } else {
         $base = clone $this;
         for ($currentPower = 1; $exponent->compareTo(new UInt128($currentPower)) > 0; $currentPower++) {
             $this->multiply($base);
         }
     }
     return $this;
 }