From 4e93202974868896fb18fcbeece17ae4ae4ef5dc Mon Sep 17 00:00:00 2001 From: messju Date: Thu, 11 Dec 2003 19:52:38 +0000 Subject: [PATCH] little optimization for "is odd" and "is even" --- libs/Smarty_Compiler.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index eb991810..3199d044 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -1387,7 +1387,7 @@ class Smarty_Compiler extends Smarty { $expr_arg = $tokens[$expr_end++]; $expr = "!(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; } else - $expr = "!($is_arg % 2)"; + $expr = "!(1 & $is_arg)"; break; case 'odd': @@ -1396,7 +1396,7 @@ class Smarty_Compiler extends Smarty { $expr_arg = $tokens[$expr_end++]; $expr = "(1 & ($is_arg / " . $this->_parse_var_props($expr_arg) . "))"; } else - $expr = "($is_arg % 2)"; + $expr = "(1 & $is_arg)"; break; case 'div':