mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 06:18:16 +00:00
Add cast to unsigned to improve div by 2 in find_internal_func()
This commit is contained in:

committed by
Thiago de Arruda

parent
db23cb05d1
commit
3f38c384ef
@@ -7155,15 +7155,13 @@ find_internal_func (
|
|||||||
{
|
{
|
||||||
int first = 0;
|
int first = 0;
|
||||||
int last = (int)(sizeof(functions) / sizeof(struct fst)) - 1;
|
int last = (int)(sizeof(functions) / sizeof(struct fst)) - 1;
|
||||||
int cmp;
|
|
||||||
int x;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the function name in the table. Binary search.
|
* Find the function name in the table. Binary search.
|
||||||
*/
|
*/
|
||||||
while (first <= last) {
|
while (first <= last) {
|
||||||
x = first + (last - first) / 2;
|
int x = first + ((unsigned)(last - first)) / 2;
|
||||||
cmp = STRCMP(name, functions[x].f_name);
|
int cmp = STRCMP(name, functions[x].f_name);
|
||||||
if (cmp < 0)
|
if (cmp < 0)
|
||||||
last = x - 1;
|
last = x - 1;
|
||||||
else if (cmp > 0)
|
else if (cmp > 0)
|
||||||
|
Reference in New Issue
Block a user