aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald van Dijk <harald@gigawatt.nl>2011-08-17 09:28:24 +0800
committermaximilian attems <max@stro.at>2012-07-02 10:46:06 +0200
commit4a12ba8937fbc47ee82ab76bd4fceddf6338dced (patch)
tree5b4146d84f60f92a293f09ebef50bdad0766001d
parentcebb8fc25475486605d12e25a3040ccacceede74 (diff)
downloadklibc-4a12ba8937fbc47ee82ab76bd4fceddf6338dced.tar.gz
[klibc] [ARITH] Avoid imaxdiv when only one of the results is wanted
dash rather pointlessly calls imaxdiv, only to discard one of its results. The call was already made conditional a while back because some systems don't have imaxdiv, but the generated code for the version with imaxdiv and the one with / and % is identical (with GCC 4.6.1 or ICC 12.0.2, with -O0, -O2 or -Os), so it could just as well go entirely to clean up the code a little bit. Signed-off-by: Harald van Dijk <harald@gigawatt.nl> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r--usr/dash/arith_yacc.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/usr/dash/arith_yacc.c b/usr/dash/arith_yacc.c
index bf2183034acc3..1a087c32ba870 100644
--- a/usr/dash/arith_yacc.c
+++ b/usr/dash/arith_yacc.c
@@ -94,22 +94,13 @@ static inline int higher_prec(int op1, int op2)
static intmax_t do_binop(int op, intmax_t a, intmax_t b)
{
-#ifdef HAVE_IMAXDIV
- imaxdiv_t div;
-#endif
-
switch (op) {
default:
case ARITH_REM:
case ARITH_DIV:
if (!b)
yyerror("division by zero");
-#ifdef HAVE_IMAXDIV
- div = imaxdiv(a, b);
- return op == ARITH_REM ? div.rem : div.quot;
-#else
return op == ARITH_REM ? a % b : a / b;
-#endif
case ARITH_MUL:
return a * b;
case ARITH_ADD: