From b5bda1d94f7a62d88c6a257a283426c16906c8cb Mon Sep 17 00:00:00 2001 From: Harald van Dijk Date: Wed, 17 Aug 2011 09:28:24 +0800 Subject: [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 Signed-off-by: Herbert Xu --- src/arith_yacc.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src') 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: -- cgit 1.4.1 tree/LICENSE?h=1.8&id=a6ede6f91f41ca20d02454de3bd33329d35fbbd1'>tree commit diff
Commit message (Collapse)Author
2018-08-07Match commands case-insensitivelyJune McEnroe
Also include the slash in their names so that they can be added to tab-complete later.
2018-08-07Convert input to multibyte before handlingJune McEnroe
2018-08-07Populate tab-complete listJune McEnroe
2018-08-07Fix /me formatting side-effectsJune McEnroe
NEVER pass side-effects to a macro.
2018-08-07Define ui.c BUF_LEN with enumJune McEnroe
2018-08-07Hack clang into checking uiFmt format stringsJune McEnroe
2018-08-07Handle PART and QUIT without messagesJune McEnroe
2018-08-07Make safe filling the who bufferJune McEnroe
2018-08-07Add reverse and reset IRC formatting codesJune McEnroe
2018-08-06Rewrite line editing again, add formattingJune McEnroe
2018-08-06Fix allocation size in vaswprintfJune McEnroe
This is so embarrassing. It only started crashing once it had strings that were long enough, and then it took me so long to notice this mistake. I was worried I was still doing va_list wrong somehow.
2018-08-06Implement word wrappingJune McEnroe
2018-08-06Use wchar_t strings for all of UIJune McEnroe
vaswprintf is a nightmare.
2018-08-06Rename line editing functionsJune McEnroe
2018-08-05Initialize all possible color pairsJune McEnroe
This is actually possible with use_default_colors!
2018-08-05Refactor color initializationJune McEnroe
2018-08-05Add ^L redrawJune McEnroe
2018-08-05Use 16 colors if availableJune McEnroe
Fall back to using bold if there are only 8 colors. This also allowed bright background colors in 16-color terminals. I must port this system to torus. I'll be able to remove the awful termcap patch hack.
2018-08-05Limit parsed colors to number of mIRC colorsJune McEnroe
Oh boy that's embarrassing.
2018-08-04Show source link on exitJune McEnroe
2018-08-04Implement line editing, scrollingJune McEnroe
Don't really have a way to implement the M-* keys, and currently missing C-w.
2018-08-04Handle /topicJune McEnroe