mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-28 07:47:02 -05:00
includes/type: Made size and float16 types more generic
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <std/io.pat>
|
||||
#include <std/math.pat>
|
||||
#include <std/mem.pat>
|
||||
|
||||
namespace type {
|
||||
|
||||
@@ -41,10 +42,10 @@ namespace type {
|
||||
result = (sign << 31) | ((exponent + (0x7F - 15)) << 23) | (mantissa << 13);
|
||||
}
|
||||
|
||||
U32ToFloatConverter converter;
|
||||
converter.intValue = result;
|
||||
std::mem::Reinterpreter<u32, float> converter;
|
||||
converter.from = result;
|
||||
|
||||
return std::format("{}", converter.floatValue);
|
||||
return std::format("{}", converter.to);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
#pragma once
|
||||
#include <std/io.pat>
|
||||
|
||||
namespace type {
|
||||
|
||||
using Size8 = u8 [[format("type::impl::size_formatter")]];
|
||||
using Size16 = u16 [[format("type::impl::size_formatter")]];
|
||||
using Size32 = u32 [[format("type::impl::size_formatter")]];
|
||||
using Size64 = u64 [[format("type::impl::size_formatter")]];
|
||||
using Size128 = u128 [[format("type::impl::size_formatter")]];
|
||||
using Size<T> = T [[format("type::impl::size_formatter")]];
|
||||
|
||||
using Size8 = Size<u8>;
|
||||
using Size16 = Size<u16>;
|
||||
using Size32 = Size<u32>;
|
||||
using Size64 = Size<u64>;
|
||||
using Size128 = Size<u128>;
|
||||
|
||||
namespace impl {
|
||||
|
||||
@@ -45,4 +46,4 @@ namespace type {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user