From fa9108f85afdc926fd6a8b96cc2acff7ca25d7a8 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Sat, 22 Jul 2023 16:07:29 +0200 Subject: refactor: Use reinterpret_cast where appropriate Also, wrap reinterpret_cast into a CharCast to ensure it is only called on byte pointers. --- src/span.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/span.h') diff --git a/src/span.h b/src/span.h index 792a0a9c07..7209d21a58 100644 --- a/src/span.h +++ b/src/span.h @@ -5,10 +5,10 @@ #ifndef BITCOIN_SPAN_H #define BITCOIN_SPAN_H -#include -#include #include -#include +#include +#include +#include #ifdef DEBUG #define CONSTEXPR_IF_NOT_DEBUG @@ -267,9 +267,9 @@ Span MakeWritableByteSpan(V&& v) noexcept } // Helper functions to safely cast to unsigned char pointers. -inline unsigned char* UCharCast(char* c) { return (unsigned char*)c; } +inline unsigned char* UCharCast(char* c) { return reinterpret_cast(c); } inline unsigned char* UCharCast(unsigned char* c) { return c; } -inline unsigned char* UCharCast(std::byte* c) { return (unsigned char*)c; } +inline unsigned char* UCharCast(std::byte* c) { return reinterpret_cast(c); } inline const unsigned char* UCharCast(const char* c) { return reinterpret_cast(c); } inline const unsigned char* UCharCast(const unsigned char* c) { return c; } inline const unsigned char* UCharCast(const std::byte* c) { return reinterpret_cast(c); } -- cgit v1.2.3