OSDN Git Service

Don't use _Generic because gcc 4.x doesn't have it...
[android-x86/external-efivar.git] / src / util.h
index 69042d3..ed60104 100644 (file)
        })
 #endif
 
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
+#if __GNUC__ >= 5 && __GNUC_MINOR__ >= 1
 #define add(a, b, c) _Generic((c),                                     \
                              int *: int_add(a,b,c),                    \
                              long *: long_add(a,b,c),                  \
                              unsigned long *: ulong_add(a,b,c))
-
 #define mult(a, b, c) _Generic((c),                                    \
                              long *: long_mult(a,b,c),                 \
                              unsigned long *: ulong_mult(a,b,c))
+#endif
+#endif
+
+#ifndef add
+#define add(a, b, c) ({                                                \
+               (*(c)) = ((a) + (b));                           \
+               })
+#endif
+#ifndef mult
+#define mult(a, b, c) ({                                       \
+               (*(c)) = ((a) * (b));                           \
+               })
+#endif
+
 
 static inline int
 __attribute__((unused))