This commit is contained in:
+21
-62
@@ -126,22 +126,7 @@ class TypeDescWriter {
|
||||
|
||||
private:
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const int8_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const int16_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const int32_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const int64_t *val) const noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const uint8_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const uint16_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const uint32_t *val) const noexcept;
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const uint64_t *val) const noexcept;
|
||||
constexpr const DescriptorType *type(const Integer_c auto *val) const noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr const DescriptorType *type(const bool *val) const noexcept;
|
||||
@@ -295,52 +280,26 @@ constexpr const DescriptorType *TypeDescWriter::type(UnionView<U> val) const noe
|
||||
return t;
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const int8_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||
constexpr auto Bytes = 1;
|
||||
return getType(types::Int8, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const int16_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||
constexpr auto Bytes = 2;
|
||||
return getType(types::Int16, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const int32_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||
constexpr auto Bytes = 4;
|
||||
return getType(types::Int32, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const int64_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::SignedInteger;
|
||||
constexpr auto Bytes = 8;
|
||||
return getType(types::Int64, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const uint8_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||
constexpr auto Bytes = 1;
|
||||
return getType(types::Uint8, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const uint16_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||
constexpr auto Bytes = 2;
|
||||
return getType(types::Uint16, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const uint32_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||
constexpr auto Bytes = 4;
|
||||
return getType(types::Uint32, 0, PT, Bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const uint64_t*) const noexcept {
|
||||
constexpr auto PT = PrimitiveType::UnsignedInteger;
|
||||
constexpr auto Bytes = 8;
|
||||
return getType(types::Uint64, 0, PT, Bytes);
|
||||
constexpr const DescriptorType *TypeDescWriter::type(Integer_c auto const *val) const noexcept {
|
||||
constexpr auto isSigned = ox::is_signed_v<decltype(*val)>;
|
||||
constexpr auto PT = isSigned ?
|
||||
PrimitiveType::SignedInteger :
|
||||
PrimitiveType::UnsignedInteger;
|
||||
constexpr auto sz = sizeof(*val);
|
||||
constexpr auto bytes = sizeof(*val);
|
||||
return getType([] {
|
||||
switch (sz) {
|
||||
case 1:
|
||||
return isSigned ? types::Int8 : types::Uint8;
|
||||
case 2:
|
||||
return isSigned ? types::Int16 : types::Uint16;
|
||||
case 4:
|
||||
return isSigned ? types::Int32 : types::Uint32;
|
||||
case 8:
|
||||
return isSigned ? types::Int64 : types::Uint64;
|
||||
}
|
||||
return types::Int32;
|
||||
}(), 0, PT, bytes);
|
||||
}
|
||||
|
||||
constexpr const DescriptorType *TypeDescWriter::type(const bool*) const noexcept {
|
||||
|
||||
Reference in New Issue
Block a user