rossellhayes / carmen
Showing 1 of 1 files from the diff.

@@ -5,30 +5,23 @@
Loading
5 5
long single_db_index(const double ip, const NumericVector ip_from) {
6 6
  if (ip_from[ip_from.size() - 1] <= ip) {return ip_from.size();}
7 7
8 -
  long p = floor(ip_from.size() / 49);
9 -
10 -
  long i = p * (
11 -
    (ip_from[48 * p] < ip) + (ip_from[47 * p] < ip) + (ip_from[46 * p] < ip) +
12 -
    (ip_from[45 * p] < ip) + (ip_from[44 * p] < ip) + (ip_from[43 * p] < ip) +
13 -
    (ip_from[42 * p] < ip) + (ip_from[41 * p] < ip) + (ip_from[40 * p] < ip) +
14 -
    (ip_from[39 * p] < ip) + (ip_from[38 * p] < ip) + (ip_from[37 * p] < ip) +
15 -
    (ip_from[36 * p] < ip) + (ip_from[35 * p] < ip) + (ip_from[34 * p] < ip) +
16 -
    (ip_from[33 * p] < ip) + (ip_from[32 * p] < ip) + (ip_from[31 * p] < ip) +
17 -
    (ip_from[30 * p] < ip) + (ip_from[29 * p] < ip) + (ip_from[28 * p] < ip) +
18 -
    (ip_from[27 * p] < ip) + (ip_from[26 * p] < ip) + (ip_from[25 * p] < ip) +
19 -
    (ip_from[24 * p] < ip) + (ip_from[23 * p] < ip) + (ip_from[22 * p] < ip) +
20 -
    (ip_from[21 * p] < ip) + (ip_from[20 * p] < ip) + (ip_from[19 * p] < ip) +
21 -
    (ip_from[18 * p] < ip) + (ip_from[17 * p] < ip) + (ip_from[16 * p] < ip) +
22 -
    (ip_from[15 * p] < ip) + (ip_from[14 * p] < ip) + (ip_from[13 * p] < ip) +
23 -
    (ip_from[12 * p] < ip) + (ip_from[11 * p] < ip) + (ip_from[10 * p] < ip) +
24 -
    (ip_from[ 9 * p] < ip) + (ip_from[ 8 * p] < ip) + (ip_from[ 7 * p] < ip) +
25 -
    (ip_from[ 6 * p] < ip) + (ip_from[ 5 * p] < ip) + (ip_from[ 4 * p] < ip) +
26 -
    (ip_from[ 3 * p] < ip) + (ip_from[ 2 * p] < ip) + (ip_from[     p] < ip)
27 -
  );
28 -
29 -
  do {i++;} while (ip_from[i] <= ip);
30 -
31 -
  return i;
8 +
  long start = 0;
9 +
  long end   = ip_from.size();
10 +
  long mid   = 0;
11 +
  long ans   = 0;
12 +
13 +
  while (start <= end) {
14 +
    mid = floor((start + end) / 2);
15 +
16 +
    if (ip_from[mid] <= ip) {
17 +
      start = mid + 1;
18 +
    } else {
19 +
      ans = mid;
20 +
      end = mid - 1;
21 +
    }
22 +
  }
23 +
24 +
  return ans;
32 25
}
33 26
34 27
// [[Rcpp::export]]
Files Coverage
R 100.00%
src/db_index.cpp 100.00%
Project Totals (4 files) 100.00%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading