Skip to content

Commit 76addf0

Browse files
committed
update includes and types
1 parent eac89ee commit 76addf0

File tree

7 files changed

+23
-10
lines changed

7 files changed

+23
-10
lines changed

include/spike/crypto/jenkinshash3.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#pragma once
2020
#include <string_view>
21+
#include <cstdint>
2122

2223
struct JenTriplet_ {
2324
uint32_t a, b, c;

include/spike/reflect/detail/reflector_class.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct reflectorStatic {
225225
types = types_;
226226
union mutate {
227227
const char *h;
228-
uintptr_t i;
228+
uintptr i;
229229
};
230230

231231
if ((mutate{members.typeName}.i | ...)) {

include/spike/reflect/detail/reflector_enum.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct ReflectedEnum {
4747

4848
union mutate {
4949
const char *h;
50-
uintptr_t i;
50+
uintptr i;
5151
};
5252

5353
if ((mutate{members.description}.i | ...)) {

include/spike/type/detail/sc_type.hpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Supercore data types
22
3-
Copyright 2018-2020 Lukas Cone
3+
Copyright 2018-2025 Lukas Cone
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -35,3 +35,19 @@ static_assert(sizeof(int64) == 8, "Unexpected integer size!");
3535
static_assert(sizeof(int32) == 4, "Unexpected integer size!");
3636
static_assert(sizeof(int16) == 2, "Unexpected integer size!");
3737
static_assert(sizeof(int8) == 1, "Unexpected integer size!");
38+
39+
template <int size> struct TypeFromSize { typedef void type; };
40+
template <> struct TypeFromSize<1> { typedef uint8 type; };
41+
template <> struct TypeFromSize<2> { typedef uint16 type; };
42+
template <> struct TypeFromSize<4> { typedef uint32 type; };
43+
template <> struct TypeFromSize<8> { typedef uint64 type; };
44+
template <> struct TypeFromSize<-1> { typedef int8 type; };
45+
template <> struct TypeFromSize<-2> { typedef int16 type; };
46+
template <> struct TypeFromSize<-4> { typedef int32 type; };
47+
template <> struct TypeFromSize<-8> { typedef int64 type; };
48+
49+
using intptr = TypeFromSize<-int(sizeof(void*))>::type;
50+
using uintptr = TypeFromSize<sizeof(void*)>::type;
51+
52+
static_assert(sizeof(intptr) == sizeof(void*));
53+
static_assert(sizeof(uintptr) == sizeof(void*));

include/spike/type/matrix44.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,7 @@ class Matrix44 {
6565
Matrix44 PC_EXTERN operator-() const;
6666

6767
void SwapEndian() { FByteswapper(v); }
68+
69+
void ReflectorTag();
6870
};
6971
} // namespace es

include/spike/util/endian.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static_assert(_fbswap<uint64>(0x0123456789abcdef) == 0xefcdab8967452301);
5050

5151
template <IsSwapableArith C> void FByteswapper(C &input, bool) {
5252
auto rType = _fbswap(
53-
reinterpret_cast<typename es::TypeFromSize<sizeof(C)>::type &>(input));
53+
reinterpret_cast<typename TypeFromSize<sizeof(C)>::type &>(input));
5454
memcpy(reinterpret_cast<char *>(&input), &rType, sizeof(input));
5555
}
5656

include/spike/util/supercore.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@ sview TrimWhitespace(sview input, bool inclNewLine = false) noexcept {
104104

105105
template <class C> void Dispose(C &item) { auto removed = std::move(item); }
106106

107-
template <size_t size> struct TypeFromSize { typedef std::false_type type; };
108-
template <> struct TypeFromSize<1> { typedef uint8 type; };
109-
template <> struct TypeFromSize<2> { typedef uint16 type; };
110-
template <> struct TypeFromSize<4> { typedef uint32 type; };
111-
template <> struct TypeFromSize<8> { typedef uint64 type; };
112-
113107
template <class, template <class...> class Op, class... Args>
114108
struct detector_ : std::false_type {};
115109

0 commit comments

Comments
 (0)