pointer: add uintptr align function
This commit is contained in:
parent
b7973dacd4
commit
191268d38b
10
pointer.hpp
10
pointer.hpp
@ -32,6 +32,16 @@ namespace util {
|
|||||||
ptr += alignment - ptr % alignment;
|
ptr += alignment - ptr % alignment;
|
||||||
return reinterpret_cast<T*> (ptr);
|
return reinterpret_cast<T*> (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
inline uintptr_t
|
||||||
|
align (uintptr_t ptr, size_t alignment)
|
||||||
|
{
|
||||||
|
return reinterpret_cast<uintptr_t> (
|
||||||
|
align (reinterpret_cast<void*> (ptr), alignment)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user