aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-04-22 03:06:29 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-24 10:32:47 -0300
commit3f38c384efe5b81c886440de2fb352cac6e581fa (patch)
tree83762e9eca8d9474b2cc60bf884602537f79a37d
parentdb23cb05d1d40487007b3c93dd54fab290fd02b7 (diff)
downloadrneovim-3f38c384efe5b81c886440de2fb352cac6e581fa.tar.gz
rneovim-3f38c384efe5b81c886440de2fb352cac6e581fa.tar.bz2
rneovim-3f38c384efe5b81c886440de2fb352cac6e581fa.zip
Add cast to unsigned to improve div by 2 in find_internal_func()
-rw-r--r--src/eval.c6
1 files changed, 2 insertions, 4 deletions
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)