summaryrefslogtreecommitdiff
path: root/misc.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2020-12-28 07:12:28 -0500
committerJeffrey Walton <noloader@gmail.com>2020-12-28 07:12:28 -0500
commite235ac57e85b1802dcb12e541344a7f228e594bc (patch)
tree004fcf73a7e1500b11157732cabd466b7e9be848 /misc.h
parentc534c833af9d2d35433dd8646e577f6a29866640 (diff)
downloadcryptopp-git-e235ac57e85b1802dcb12e541344a7f228e594bc.tar.gz
Use pointer-to-T in IsAligned<T> (GH #992)
Diffstat (limited to 'misc.h')
-rw-r--r--misc.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/misc.h b/misc.h
index 5f9e6eed..83bf49ec 100644
--- a/misc.h
+++ b/misc.h
@@ -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)