1. template<std::size_t N>
    2. inline bool IsAlignedPtr(const void *ptr) {
    3. static_assert((N & (N-1)) == 0, "N must be power of 2");
    4. return (reinterpret_cast<std::uintptr_t>(ptr) & (N-1)) == 0;
    5. }