diff --git a/include/bx/handlealloc.h b/include/bx/handlealloc.h index d0ebf88..3195f39 100644 --- a/include/bx/handlealloc.h +++ b/include/bx/handlealloc.h @@ -260,7 +260,7 @@ namespace bx link.m_prev = _handle; } - updateFirstLast(_handle); + updateFrontBack(_handle); } void insertAfter(uint16_t _after, uint16_t _handle) @@ -281,7 +281,7 @@ namespace bx link.m_next = _handle; } - updateFirstLast(_handle); + updateFrontBack(_handle); } bool isValid(uint16_t _handle) const @@ -289,7 +289,7 @@ namespace bx return _handle < MaxHandlesT; } - void updateFirstLast(uint16_t _handle) + void updateFrontBack(uint16_t _handle) { Link& curr = m_links[_handle]; diff --git a/tests/handle.cpp b/tests/handle.cpp index 887d21f..455e7e4 100644 --- a/tests/handle.cpp +++ b/tests/handle.cpp @@ -68,9 +68,9 @@ TEST(HandleAllocLruT) lru.alloc(), }; - lru.touch(handle[3]); + lru.touch(handle[1]); - uint16_t expected0[] = { handle[3], handle[0], handle[1], handle[2] }; + uint16_t expected0[] = { handle[1], handle[3], handle[2], handle[0] }; uint16_t count = 0; for (uint16_t it = lru.getFront(); it != UINT16_MAX; it = lru.getNext(it), ++count) {