25 int right = (int)maxSize;
27 while (left < right) {
28 int mid = (left + right) / 2;
29 if (startLoc[mid] == target) {
32 else if (startLoc[mid] < target) {
35 else if (startLoc[mid] > target) {
56 if (maxSize == 0)
return -1;
57 int left = 0, right = (int)maxSize;
59 while (left < right) {
60 int mid = (left + right) / 2;
61 if (startLoc[mid] == target) {
64 else if (startLoc[mid] < target) {
67 else if (startLoc[mid] > target) {
This is an implementation of AdditiveCCD based on peridyno.
DYN_FUNC int leftBound(T target, T *startLoc, uint maxSize)
Find the left bound of a target with a binary search algorithm.
DYN_FUNC int rightBound(T target, T *startLoc, uint maxSize)
Find the right bound of a target with a binary search algorithm.