summaryrefslogtreecommitdiff
path: root/expt_0802.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'expt_0802.cpp')
-rw-r--r--expt_0802.cpp15
1 files changed, 0 insertions, 15 deletions
diff --git a/expt_0802.cpp b/expt_0802.cpp
index fbd6c23..b1a906a 100644
--- a/expt_0802.cpp
+++ b/expt_0802.cpp
@@ -25,8 +25,6 @@ size_t calculate_location(size_t index) {
}
typedef int key_type;
-inline double safeStep(double step) { return step < 0 ? 0 : step; }
-
int get_son_from_step(int point, bool negative) {
return negative ? point * 2 : point * 2 + 1;
}
@@ -34,31 +32,18 @@ int get_son_from_step(int point, bool negative) {
const key_type *cudaBinarySearch(key_type *const start, const key_type *end,
const key_type val) {
int step_limit = (int)std::log2(LENGTH) + 1;
- const auto length = (end - start);
key_type *last_known_point = start;
auto son = 0;
for (int i = 0; i < step_limit; i++) {
const auto next_level_start = start + (1 << (i + 1)) - 1;
- /*const auto current_time = (1.0 / (1 << (i + 1)));
- printf("%d ", *level_start);
- printf("%d %d\n", *last_known_point, (1 << i));
if (*last_known_point == val) {
- puts("find");
- return last_known_point;
- }
- sum = safeStep(sum +
- ((*last_known_point > val) ? -current_time : current_time));
- last_known_point = level_start + (int)(sum * (double)(1 << i));*/
- if (*last_known_point == val) {
- puts("found");
return last_known_point;
}
son = get_son_from_step(son, (*last_known_point > val));
last_known_point = next_level_start + son;
printf("%d\n", *last_known_point);
}
- puts("");
return last_known_point;
}