summaryrefslogtreecommitdiffstats
path: root/modules-available/dnbd3/inc/dnbd3util.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2023-11-15 18:01:19 +0100
committerSimon Rettberg2023-11-15 18:01:19 +0100
commit8ffd1098ac21e209f4b90e1dde611aa1bd37cf9a (patch)
treec002481ce823abde49a8f65ac3e76f9afd43eeb1 /modules-available/dnbd3/inc/dnbd3util.inc.php
parentFix more type errors, stricter typing (diff)
downloadslx-admin-8ffd1098ac21e209f4b90e1dde611aa1bd37cf9a.tar.gz
slx-admin-8ffd1098ac21e209f4b90e1dde611aa1bd37cf9a.tar.xz
slx-admin-8ffd1098ac21e209f4b90e1dde611aa1bd37cf9a.zip
Remove 32bit support
int is always the native word size, and we don't really test anything on 32bit OSes anymore. 32bit support already required ugly workarounds in the past for large file sizes and ip2long, so we can finally get rid of those and just put an initial check in install.php.
Diffstat (limited to 'modules-available/dnbd3/inc/dnbd3util.inc.php')
-rw-r--r--modules-available/dnbd3/inc/dnbd3util.inc.php13
1 files changed, 3 insertions, 10 deletions
diff --git a/modules-available/dnbd3/inc/dnbd3util.inc.php b/modules-available/dnbd3/inc/dnbd3util.inc.php
index 47d7a4ea..7d95147a 100644
--- a/modules-available/dnbd3/inc/dnbd3util.inc.php
+++ b/modules-available/dnbd3/inc/dnbd3util.inc.php
@@ -136,13 +136,10 @@ class Dnbd3Util {
array('locs' => array_values($recursiveLocs)));
// Coalesce overlapping ranges
$floatIp = ip2long($self); // Float for 32bit php :/
- if (PHP_INT_SIZE === 4) {
- $floatIp = (float)sprintf('%u', $floatIp); // Float for 32bit php :/
- }
$ranges = [['startaddr' => $floatIp, 'endaddr' => $floatIp]];
foreach ($res as $row) {
- settype($row['startaddr'], PHP_INT_SIZE === 4 ? 'float' : 'int');
- settype($row['endaddr'], PHP_INT_SIZE === 4 ? 'float' : 'int');
+ settype($row['startaddr'], 'int');
+ settype($row['endaddr'], 'int');
self::mergeRanges($ranges, $row);
}
// Got subnets, build whitelist
@@ -215,11 +212,7 @@ class Dnbd3Util {
*/
private static function range2Cidr(int $start, int $end): string
{
- if (PHP_INT_SIZE > 4) {
- $bin = decbin($start ^ $end);
- } else {
- $bin = decbin((int)(float)$start ^ (int)(float)$end);
- }
+ $bin = decbin($start ^ $end);
if ($bin === '0')
return long2ip($start);
$mask = 32 - strlen($bin);