From 4c8a2ea1c05b01dcda5c725a055693c6b25a6664 Mon Sep 17 00:00:00 2001 From: LeoVerto Date: Wed, 25 Oct 2023 03:06:39 +0200 Subject: [PATCH] Fix deaggregate failing on perl 5.38 Workaround for a bug causing an infinite recursion when comparing a BigInt to a BigFloat, introduced in Math::BigInt 1.999840 and fixed in 1.999842. See pjacklam/p5-Math-BigInt@d268562 Fixes #15, fixes #17. --- ipcalc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ipcalc b/ipcalc index 803694a..8e57a5b 100755 --- a/ipcalc +++ b/ipcalc @@ -701,9 +701,10 @@ sub deaggregate { $step = 0; while (($base | (1 << $step)) != $base) { - if (($base | (((~0) & $thirtytwobits) >> (31-$step))) > $end) { - last; - } + my $mask = (((~0) & $thirtytwobits) >> (31-$step))->as_int(); + if (($base | $mask) > $end) { + last; + } $step++; } print ntoa($base)."/" .(32-$step);