From 12a6845b6c91cf76caf3199495d76b16bba1f2fe Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Tue, 3 Apr 2012 13:20:21 -0700 Subject: [PATCH] Use $((...)) instead of expr. Use $((...)) for math in size_classes.h rather than expr, because it is much faster. This is not supported syntax in the classic Bourne shell, but all modern sh implementations support it, including bash, zsh, and ash. --- include/jemalloc/internal/size_classes.sh | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/include/jemalloc/internal/size_classes.sh b/include/jemalloc/internal/size_classes.sh index 9829a2b3..3d236136 100755 --- a/include/jemalloc/internal/size_classes.sh +++ b/include/jemalloc/internal/size_classes.sh @@ -17,8 +17,8 @@ pow2() { e=$1 pow2_result=1 while [ ${e} -gt 0 ] ; do - pow2_result=`expr ${pow2_result} + ${pow2_result}` - e=`expr ${e} - 1` + pow2_result=$((${pow2_result} + ${pow2_result})) + e=$((${e} - 1)) done } @@ -45,7 +45,7 @@ EOF bin=0 psz=0 sz=${t} - delta=`expr ${sz} - ${psz}` + delta=$((${sz} - ${psz})) cat <