From 3d362bb0bf54b4e31ed74861a71a99a4d64574b1 Mon Sep 17 00:00:00 2001 From: lephe Date: Thu, 4 Jul 2019 12:15:00 -0400 Subject: [PATCH] defs: remove useless definitions --- include/gint/defs/util.h | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/include/gint/defs/util.h b/include/gint/defs/util.h index 6f3452c..b36446f 100644 --- a/include/gint/defs/util.h +++ b/include/gint/defs/util.h @@ -2,6 +2,9 @@ // gint:defs:util - Various utility macros //--- +#ifndef GINT_DEFS_UTIL +#define GINT_DEFS_UTIL + /* min(), max() (without double evaluation) */ #define min(a, b) ({ \ __auto_type _a = (a); \ @@ -35,33 +38,4 @@ (b) = _tmp; \ }) -//--- -// Const casts -//--- - -/* const_cast() - perform const casts - This is intended for initialization purposes only, like "final" in Java. - This macro is the most generic form without any type inference; using - const_cint() or const_cptr() may be more convenient for simple types */ -#define const_cast(x, T) (*((T *)(&(x)))) - -/* const_cptr() - perform const casts on pointers */ -#define const_cptr(x) (*((void **)(&(x)))) - -/* const_cint() - perform const casts on integers - This macro infers the integer type it's using, which may avoid errors when - types change during code maintenance. It only works on primitive types and - their aliases, this is on purpose to avoid integer coercion with tricks such - as typeof(x + 0). */ -#define const_cint(x) (*_Generic((x), \ - char: (char *) (&(x)), \ - unsigned char: (unsigned char *) (&(x)), \ - short: (short *) (&(x)), \ - unsigned short: (unsigned short *) (&(x)), \ - int: (int *) (&(x)), \ - unsigned int: (unsigned int *) (&(x)), \ - long: (long *) (&(x)), \ - unsigned long: (unsigned long *) (&(x)), \ - long long: (long long *) (&(x)), \ - unsigned long long: (unsigned long long *) (&(x)) \ -)) +#endif /* GINT_DEFS_UTIL */