From 624ff894a4ecf04b6e7d0316cf452880a21d4bd2 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Mon, 16 Jun 2025 09:41:59 -0400 Subject: pk.h: update to 0.6.1 --- src/pk.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/pk.h b/src/pk.h index 1c4b945..42c144b 100644 --- a/src/pk.h +++ b/src/pk.h @@ -1,7 +1,7 @@ #ifndef PK_SINGLE_HEADER_FILE_H #define PK_SINGLE_HEADER_FILE_H /******************************************************************************* -* PK Single-Header-Library V0.6.0 +* PK Single-Header-Library V0.6.1 * * Author: Jonathan Bradley * Copyright: © 2024-2025 Jonathan Bradley @@ -291,7 +291,7 @@ * *******************************************************************************/ -#define PK_VERSION "0.6.0" +#define PK_VERSION "0.6.1" #ifdef PK_IMPL_ALL # ifndef PK_IMPL_MEM_TYPES @@ -478,8 +478,8 @@ return a; \ }; \ TypeName operator~(TypeName& a) { \ - a = static_cast(~static_cast(a)); \ - return a; \ + TypeName_T b{static_cast(a)}; \ + return TypeName{static_cast(~b)}; \ }; #define TypeSafeInt_H(TypeName, Type, Max) \ TypeSafeInt2_H(TypeName, Type, Max, PK_CONCAT(TypeName, _T), PK_CONCAT(TypeName, _MAX), PK_CONCAT(TypeName, _T_MAX)) @@ -563,7 +563,8 @@ return a; \ }; \ constexpr TypeName operator~(const TypeName& a) { \ - return static_cast(~static_cast(a)); \ + TypeName_T b{static_cast(a)}; \ + return TypeName{static_cast(~b)}; \ }; #define TypeSafeInt_constexpr(TypeName, Type, Max) \ TypeSafeInt2_H_constexpr(TypeName, Type, Max, PK_CONCAT(TypeName, _T), PK_CONCAT(TypeName, _MAX), PK_CONCAT(TypeName, _T_MAX)) -- cgit v1.2.3