From cec79a3f5578da4a9f9085282389482edf45c81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 16 Mar 2025 12:48:45 +0100 Subject: New upstream version 4.26 --- include/libHX/defs.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'include/libHX/defs.h') diff --git a/include/libHX/defs.h b/include/libHX/defs.h index ba84b37..2ef5769 100644 --- a/include/libHX/defs.h +++ b/include/libHX/defs.h @@ -12,7 +12,16 @@ # ifndef containerof # include # include -# define containerof(var, T, member) reinterpret_cast::type>::value, std::add_const::type, T>::type *>(reinterpret_cast::type>::value, const char, char>::type *>(var) - offsetof(T, member)) +namespace { +template static inline auto containerof_cxx(Src *var, size_t ofs) +{ + using K = typename std::is_const::type>; + using Ch = typename std::conditional::type; + using D2 = typename std::conditional::type; + return reinterpret_cast(reinterpret_cast(var) + ofs); +} +} +# define containerof(var, D1, member) containerof_cxx(var, -offsetof(D1, member)) # endif #else # define HXsizeof_member(type, member) sizeof(((type *)NULL)->member) @@ -86,6 +95,7 @@ #define HXSIZEOF_Z32 sizeof("-4294967296") /* 2^64 and -2^63 have same length */ #define HXSIZEOF_Z64 sizeof("18446744073709551616") +#define HXSIZEOF_UNITSEC64 sizeof("584542046089y11months2weeks2d23h59min59s") #define __HX_STRINGIFY_EXPAND(s) #s #define HX_STRINGIFY(s) __HX_STRINGIFY_EXPAND(s) -- cgit v1.2.3