Skip to content

Commit

Permalink
Small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
KredeGC committed May 23, 2023
1 parent 4317a2a commit fd6238a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion include/ktl/containers/packed_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ namespace ktl
explicit packed_ptr(PtrT p, Int value) noexcept :
m_Value((reinterpret_cast<uintptr_t>(p) & PTR_MASK) | (static_cast<uintptr_t>(value) & INT_MASK))
{
static_assert(std::is_unsigned_v<Int>, "Packed integer must be unsigned");

// Pointer must be correctly aligned
KTL_ASSERT((reinterpret_cast<size_t>(p) & (Alignment - 1)) == 0);
}

operator bool() const noexcept { return m_Value; }
explicit operator bool() const noexcept { return m_Value; }

PtrT get_ptr() const noexcept { return reinterpret_cast<PtrT>(m_Value & PTR_MASK); }

Expand Down
2 changes: 1 addition & 1 deletion include/ktl/containers/trivial_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace ktl
* @brief Construct the vector with the given allocator
* @param allocator The allocator to use
*/
trivial_vector(const Alloc& allocator) noexcept :
explicit trivial_vector(const Alloc& allocator) noexcept :
m_Alloc(allocator),
m_Begin(nullptr),
m_End(nullptr),
Expand Down

0 comments on commit fd6238a

Please sign in to comment.