aboutsummaryrefslogtreecommitdiff
path: root/src/span.h
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-07-22 16:07:29 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-07-24 15:32:35 +0200
commitfa9108f85afdc926fd6a8b96cc2acff7ca25d7a8 (patch)
tree669d4ff3edc8e863d397bf2e9d20313be4a794cb /src/span.h
parent3333f950d49f13662842650ae76599a0dff052eb (diff)
refactor: Use reinterpret_cast where appropriate
Also, wrap reinterpret_cast into a CharCast to ensure it is only called on byte pointers.
Diffstat (limited to 'src/span.h')
-rw-r--r--src/span.h10
1 files changed, 5 insertions, 5 deletions
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 <type_traits>
-#include <cstddef>
#include <algorithm>
-#include <assert.h>
+#include <cassert>
+#include <cstddef>
+#include <type_traits>
#ifdef DEBUG
#define CONSTEXPR_IF_NOT_DEBUG
@@ -267,9 +267,9 @@ Span<std::byte> 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<unsigned char*>(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<unsigned char*>(c); }
inline const unsigned char* UCharCast(const char* c) { return reinterpret_cast<const unsigned char*>(c); }
inline const unsigned char* UCharCast(const unsigned char* c) { return c; }
inline const unsigned char* UCharCast(const std::byte* c) { return reinterpret_cast<const unsigned char*>(c); }