summary refs log tree commit diff
path: root/src/arith_yacc.c
diff options
context:
space:
mode:
authorHarald van Dijk <harald@gigawatt.nl>2011-08-17 09:28:24 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2011-08-17 09:28:24 +0800
commitb5bda1d94f7a62d88c6a257a283426c16906c8cb (patch)
tree06613b5c3f6061702960e49dada94be9436241fc /src/arith_yacc.c
parent[SHELL] Fix klibc DEBUG compilation (diff)
downloaddash-b5bda1d94f7a62d88c6a257a283426c16906c8cb.tar.gz
dash-b5bda1d94f7a62d88c6a257a283426c16906c8cb.zip
[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>
Diffstat (limited to 'src/arith_yacc.c')
-rw-r--r--src/arith_yacc.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/src/arith_yacc.c b/src/arith_yacc.c
index bf21830..1a087c3 100644
--- a/src/arith_yacc.c
+++ b/src/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:
ing 2013-05-13t0109: "function" is a bash-ismJohn Keeping 2013-05-13New mailing list.Jason A. Donenfeld 2013-04-30ui-snapshot: do not access $HOMEJason A. Donenfeld 2013-04-27t0001: validate Git -rcN version numbers correctlyJohn Keeping 2013-04-27git: update to 1.8.2.2John Keeping 2013-04-17scan-tree: fix regression in section-from-path=-1John Keeping 2013-04-15t0001: ignore ".dirty" suffix on Git versionJohn Keeping 2013-04-15tests: set TEST_OUTPUT_DIRECTORY to the CGit test directoryJohn Keeping 2013-04-15t0109: test more URLsJohn Keeping 2013-04-10cgitrc.5.txt: Specify when scan-path must be defined before.Jason A. Donenfeld 2013-04-10ui-snapshot.c: Prepend "V" when guessing ref namesLukas Fleischer 2013-04-10t0107: Skip ZIP tests if unzip(1) isn't availableLukas Fleischer 2013-04-10tests/: Do not use `sed -i`Lukas Fleischer 2013-04-10Add branch-sort and repo.branch-sort options.Jason A. Donenfeld 2013-04-10t0109: chain operations with &&John Keeping 2013-04-10cgit.c: Do not restore unset environment variablesLukas Fleischer 2013-04-09t0107: Use `tar -z` for gzip'ed archivesLukas Fleischer