projects
/
pihpsdr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
647e0df
)
fixes an overflow (for very large number of elements) in binary search
author
Ramakrishnan Muthukrishnan
<ram@rkrishnan.org>
Fri, 10 Nov 2023 02:00:09 +0000
(07:30 +0530)
committer
Ramakrishnan Muthukrishnan
<ram@rkrishnan.org>
Fri, 10 Nov 2023 02:00:09 +0000
(07:30 +0530)
rigctl.c
patch
|
blob
|
history
diff --git
a/rigctl.c
b/rigctl.c
index b1adbdce8ecff9f9db795d05b73e69ca88de0a4f..a38d4a5e955a91687d6dfdbf4e9631754a3aba6b 100644
(file)
--- a/
rigctl.c
+++ b/
rigctl.c
@@
-4539,7
+4539,8
@@
bool search(cat_command *commands, char cmd[2], int *index) {
while (l <= r) {
// go to the middle of the array[r:l]
// and pick out the middle element.
- int m = (l + r)/2;
+ // int m = (l + r)/2;
+ int m = l + (r - l)/2;
// compare the command name in the middle element
// with the one we are looking for.