Skip to content

Commit 339fe8d

Browse files
author
Nathan Shreve
committed
Revert "parent() is now static function"
This reverts commit c58ca70.
1 parent c58ca70 commit 339fe8d

File tree

5 files changed

+7
-2
lines changed

5 files changed

+7
-2
lines changed

vpr/src/route/binary_heap.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
// child indices of a heap
55
static inline size_t left(size_t i) { return i << 1; }
66
static inline size_t right(size_t i) { return (i << 1) + 1; }
7-
static inline size_t parent(size_t i) { return i >> 1; }
7+
8+
inline size_t BinaryHeap::parent(size_t i) const { return i >> 1; }
89

910
bool BinaryHeap::is_valid() const {
1011
if (heap_.empty()) {

vpr/src/route/binary_heap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class BinaryHeap : public KAryHeap {
1111

1212
private:
1313
void sift_down(size_t hole) final;
14+
size_t parent(size_t i) const final;
1415
};
1516

1617
#endif //VTR_BINARY_HEAP_H

vpr/src/route/four_ary_heap.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#include "vtr_log.h"
33

44
static inline size_t first_child(size_t i) { return (i << 2) - 2; }
5-
static inline size_t parent(size_t i) { return (i + 2) >> 2; }
5+
6+
inline size_t FourAryHeap::parent(size_t i) const { return (i + 2) >> 2; }
67

78
inline size_t FourAryHeap::smallest_child(size_t i) const {
89
// Returns first_child(i) if i has no children

vpr/src/route/four_ary_heap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class FourAryHeap : public KAryHeap {
1111

1212
private:
1313
void sift_down(size_t hole) final;
14+
size_t parent(size_t i) const final;
1415
size_t smallest_child(size_t i) const;
1516
};
1617

vpr/src/route/k_ary_heap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class KAryHeap : public HeapInterface {
3737
void prune_heap();
3838

3939
virtual void sift_down(size_t hole) = 0;
40+
virtual size_t parent(size_t i) const = 0;
4041

4142
HeapStorage storage_;
4243

0 commit comments

Comments
 (0)