diff options
author | Jeffrey Walton <noloader@gmail.com> | 2020-12-28 07:12:28 -0500 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2020-12-28 07:12:28 -0500 |
commit | e235ac57e85b1802dcb12e541344a7f228e594bc (patch) | |
tree | 004fcf73a7e1500b11157732cabd466b7e9be848 /misc.h | |
parent | c534c833af9d2d35433dd8646e577f6a29866640 (diff) | |
download | cryptopp-git-e235ac57e85b1802dcb12e541344a7f228e594bc.tar.gz |
Use pointer-to-T in IsAligned<T> (GH #992)
Diffstat (limited to 'misc.h')
-rw-r--r-- | misc.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1212,14 +1212,15 @@ inline bool IsAlignedOn(const void *ptr, unsigned int alignment) /// \brief Determines whether ptr is minimally aligned
/// \tparam T class or type
/// \param ptr the pointer to check for alignment
-/// \return true if <tt>ptr</tt> is aligned to at least <tt>T</tt>
+/// \return true if <tt>ptr</tt> is aligned to at least a pointer to <tt>T</tt>
/// boundary, false otherwise
/// \details Internally the function calls IsAlignedOn with a second
-/// parameter of GetAlignmentOf<T>.
+/// parameter of GetAlignmentOf<T*>.
template <class T>
inline bool IsAligned(const void *ptr)
{
- return IsAlignedOn(ptr, GetAlignmentOf<T>());
+ // Switch to T* due to https://github.com/weidai11/cryptopp/issues/992
+ return IsAlignedOn(ptr, GetAlignmentOf<T*>());
}
#if (CRYPTOPP_LITTLE_ENDIAN)
|