summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorSimon Rettberg2023-11-15 18:01:19 +0100
committerSimon Rettberg2023-11-15 18:01:19 +0100
commit8ffd1098ac21e209f4b90e1dde611aa1bd37cf9a (patch)
treec002481ce823abde49a8f65ac3e76f9afd43eeb1 /inc
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 'inc')
-rw-r--r--inc/iputil.inc.php5
-rw-r--r--inc/util.inc.php6
2 files changed, 1 insertions, 10 deletions
diff --git a/inc/iputil.inc.php b/inc/iputil.inc.php
index caac7349..a50f22eb 100644
--- a/inc/iputil.inc.php
+++ b/inc/iputil.inc.php
@@ -58,9 +58,6 @@ class IpUtil
$ip = ip2long($cidr);
if ($ip === false)
return null;
- if (PHP_INT_SIZE === 4) {
- $ip = sprintf('%u', $ip);
- }
return ['start' => $ip, 'end' => $ip];
}
$ip = $parts[0];
@@ -75,8 +72,6 @@ class IpUtil
if ($ip === false)
return null;
$bits = (int)((2 ** (32 - $bits)) - 1);
- if (PHP_INT_SIZE === 4)
- return ['start' => sprintf('%u', $ip & ~$bits), 'end' => sprintf('%u', $ip | $bits)];
return ['start' => $ip & ~$bits, 'end' => $ip | $bits];
}
diff --git a/inc/util.inc.php b/inc/util.inc.php
index a5ccdc77..267a3971 100644
--- a/inc/util.inc.php
+++ b/inc/util.inc.php
@@ -103,11 +103,7 @@ class Util
public static function readableFileSize($bytes, int $decimals = -1, int $shift = 0): string
{
// round doesn't reliably work for large floats, pick workaround depending on OS
- if (PHP_INT_SIZE === 4) {
- $bytes = sprintf('%.0f', $bytes);
- } else {
- $bytes = sprintf('%u', $bytes);
- }
+ $bytes = sprintf('%u', $bytes);
static $sz = array('Byte', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB');
$factor = (int)floor((strlen($bytes) - 1) / 3);
if ($factor === 0) {