From 3f38c384efe5b81c886440de2fb352cac6e581fa Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Tue, 22 Apr 2014 03:06:29 -0300 Subject: Add cast to unsigned to improve div by 2 in find_internal_func() --- src/eval.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/eval.c b/src/eval.c index e5a869b923..54dbd06f79 100644 --- a/src/eval.c +++ b/src/eval.c @@ -7155,15 +7155,13 @@ find_internal_func ( { int first = 0; int last = (int)(sizeof(functions) / sizeof(struct fst)) - 1; - int cmp; - int x; /* * Find the function name in the table. Binary search. */ while (first <= last) { - x = first + (last - first) / 2; - cmp = STRCMP(name, functions[x].f_name); + int x = first + ((unsigned)(last - first)) / 2; + int cmp = STRCMP(name, functions[x].f_name); if (cmp < 0) last = x - 1; else if (cmp > 0) -- cgit