little optimization for "is odd" and "is even"

This commit is contained in:
messju
2003-12-11 19:52:38 +00:00
parent aa8f02c429
commit 4e93202974

View File

@@ -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':