Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Created October 3, 2019 19:59
Show Gist options
  • Save MasterDuke17/c643f663247457458ffda483f498ebcd to your computer and use it in GitHub Desktop.
Save MasterDuke17/c643f663247457458ffda483f498ebcd to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Optimizer.nqp b/src/Perl6/Optimizer.nqp
index 3f41993dc..b70badaa3 100644
--- a/src/Perl6/Optimizer.nqp
+++ b/src/Perl6/Optimizer.nqp
@@ -1955,13 +1955,13 @@ class Perl6::Optimizer {
# 1024 is just a heuristic, measuring might show a bigger value would be fine.
if $all_args_known && self.op_eq_core($op, '&infix:<x>') {
my int $survived := 0;
- my int $size;
+ my num $size;
try {
- $size := @args[0].chars * @args[1];
+ $size := nqp::mul_n(@args[0].chars, @args[1]);
$survived := 1;
}
- return $op if $survived && $size > 1024;
+ return $op if $survived && nqp::isgt_n($size, 1024.0);
}
# If so, attempt to constant fold.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment