diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-08 16:41:27 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-03-08 16:41:27 -0400 |
commit | c194e33e98492bbd0384f2a6b9a533bcfb57701d (patch) | |
tree | b029d62b0ab06f10852ec5d409094ffd0f3f19e2 /include | |
parent | 09c901655db3bb42d2aac4b506846b18833d777c (diff) |
macros: Add `as()`
Diffstat (limited to 'include')
-rw-r--r-- | include/pso/TPlySmth.h | 6 | ||||
-rw-r--r-- | include/pso/macros.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/include/pso/TPlySmth.h b/include/pso/TPlySmth.h index 2530c7b..e510047 100644 --- a/include/pso/TPlySmth.h +++ b/include/pso/TPlySmth.h @@ -2,8 +2,8 @@ #define TPLYSMTH_H #include <global_types.h> +#include <pso/macros.h> #include <pso/protocol.h> -#include <pso/TArray.h> #include <pso/TProtocol.h> class TPlySmth { @@ -11,8 +11,8 @@ public: TPlySmth() {}; void bswap() { - bswap_32(reinterpret_cast<u32 *>(&m_smth)); - bswap_32(reinterpret_cast<u32 *>(&m_smth1)); + bswap_32(as(u32 *, &m_smth)); + bswap_32(as(u32 *, &m_smth1)); }; public: u8 m_smth[4]; diff --git a/include/pso/macros.h b/include/pso/macros.h index 291a550..e182c54 100644 --- a/include/pso/macros.h +++ b/include/pso/macros.h @@ -108,4 +108,6 @@ PRIVATE_MEMBER_GETTER_FUNC(ret_type, name, __VA_ARGS__); \ PRIVATE_MEMBER_SETTER_FUNC(ret_type, name, __VA_ARGS__) +#define as(type, var) reinterpret_cast<type>(var) + #endif |