mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-27 18:48:13 +00:00
🚿 remove extra includes
This commit is contained in:
+1
-4
@@ -48,10 +48,7 @@
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"chillerlan\\QRCode\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/includes.php"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @created 24.01.2021
|
||||
* @package chillerlan\QRCode\Common
|
||||
* @author ZXing Authors
|
||||
* @author Smiley <smiley@chillerlan.net>
|
||||
* @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));
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @created 10.01.2021
|
||||
* @author smiley <smiley@chillerlan.net>
|
||||
* @copyright 2021 smiley
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
namespace chillerlan\QRCode;
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
if(!\defined('QRCODE_DECODER_INCLUDES')){
|
||||
require_once __DIR__.'/Common/functions.php';
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreEnd
|
||||
Reference in New Issue
Block a user