From f6e68e097cecb002ddb9b95f8099d81bc5162399 Mon Sep 17 00:00:00 2001 From: codemasher Date: Sat, 5 Jun 2021 01:17:04 +0200 Subject: [PATCH] :shower: remove extra includes --- composer.json | 5 +--- src/Common/functions.php | 58 ---------------------------------------- src/includes.php | 16 ----------- 3 files changed, 1 insertion(+), 78 deletions(-) delete mode 100644 src/Common/functions.php delete mode 100644 src/includes.php diff --git a/composer.json b/composer.json index 311442500..536bdf56f 100644 --- a/composer.json +++ b/composer.json @@ -48,10 +48,7 @@ "autoload": { "psr-4": { "chillerlan\\QRCode\\": "src/" - }, - "files": [ - "src/includes.php" - ] + } }, "autoload-dev": { "psr-4": { diff --git a/src/Common/functions.php b/src/Common/functions.php deleted file mode 100644 index ebfa03094..000000000 --- a/src/Common/functions.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @copyright 2021 Smiley - * @license Apache-2.0 - */ - -namespace chillerlan\QRCode\Common; - -use function array_slice, array_splice, sqrt; -use const PHP_INT_SIZE; - -const QRCODE_DECODER_INCLUDES = true; - -function arraycopy(array $srcArray, int $srcPos, array $destArray, int $destPos, int $length):array{ - array_splice($destArray, $destPos, $length, array_slice($srcArray, $srcPos, $length)); - - return $destArray; -} - -function uRShift(int $a, int $b):int{ - - if($b === 0){ - return $a; - } - - return ($a >> $b) & ~((1 << (8 * PHP_INT_SIZE - 1)) >> ($b - 1)); -} - -function numBitsDiffering(int $a, int $b):int{ - // a now has a 1 bit exactly where its bit differs with b's - $a ^= $b; - // Offset i holds the number of 1 bits in the binary representation of i - $BITS_SET_IN_HALF_BYTE = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4]; - // Count bits set quickly with a series of lookups: - $count = 0; - - for($i = 0; $i < 32; $i += 4){ - $count += $BITS_SET_IN_HALF_BYTE[uRShift($a, $i) & 0x0F]; - } - - return $count; -} - -function squaredDistance(float $aX, float $aY, float $bX, float $bY):float{ - $xDiff = $aX - $bX; - $yDiff = $aY - $bY; - - return $xDiff * $xDiff + $yDiff * $yDiff; -} - -function distance(float $aX, float $aY, float $bX, float $bY):float{ - return sqrt(squaredDistance($aX, $aY, $bX, $bY)); -} - diff --git a/src/includes.php b/src/includes.php deleted file mode 100644 index 0e326fcaa..000000000 --- a/src/includes.php +++ /dev/null @@ -1,16 +0,0 @@ - - * @copyright 2021 smiley - * @license MIT - */ - -namespace chillerlan\QRCode; - -// @codeCoverageIgnoreStart -if(!\defined('QRCODE_DECODER_INCLUDES')){ - require_once __DIR__.'/Common/functions.php'; -} - -// @codeCoverageIgnoreEnd