diff options
Diffstat (limited to 'src/gallium/state_trackers/clover/util/pointer.hpp')
-rw-r--r-- | src/gallium/state_trackers/clover/util/pointer.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/clover/util/pointer.hpp b/src/gallium/state_trackers/clover/util/pointer.hpp index aa119a4b82b..7bb9951aef6 100644 --- a/src/gallium/state_trackers/clover/util/pointer.hpp +++ b/src/gallium/state_trackers/clover/util/pointer.hpp @@ -27,6 +27,17 @@ namespace clover { /// + /// Some helper functions for raw pointer operations + /// + template <class T> + static bool + ptr_is_aligned(const T *ptr, uintptr_t a) noexcept { + assert(a == (a & -a)); + uintptr_t ptr_value = reinterpret_cast<uintptr_t>(ptr); + return (ptr_value & (a - 1)) == 0; + } + + /// /// Base class for objects that support reference counting. /// class ref_counter { |