Fix PtrByteDiff cast

A quick testing pass that loaded the code with asserts caused a compile failure
pull/687/head
Jeffrey Walton 2018-07-12 09:37:43 -04:00
parent bbf9a109f2
commit 25179e00d3
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 1 additions and 1 deletions

2
misc.h
View File

@ -413,7 +413,7 @@ inline ptrdiff_t PtrDiff(const PTR pointer1, const PTR pointer2)
template <typename PTR> template <typename PTR>
inline size_t PtrByteDiff(const PTR pointer1, const PTR pointer2) inline size_t PtrByteDiff(const PTR pointer1, const PTR pointer2)
{ {
return (size_t)(static_cast<uintptr_t>(pointer1) - static_cast<uintptr_t>(pointer2)); return (size_t)(reinterpret_cast<uintptr_t>(pointer1) - reinterpret_cast<uintptr_t>(pointer2));
} }
#if (!__STDC_WANT_SECURE_LIB__ && !defined(_MEMORY_S_DEFINED)) || defined(CRYPTOPP_WANT_SECURE_LIB) #if (!__STDC_WANT_SECURE_LIB__ && !defined(_MEMORY_S_DEFINED)) || defined(CRYPTOPP_WANT_SECURE_LIB)