OSDN Git Service

am 548d70b0: am 23966773: Rename absoluteMaxSize to maximumSize.
[android-x86/dalvik.git] / vm / Common.h
index 4b357e2..208ed20 100644 (file)
 # undef assert
 # define assert(x) \
     ((x) ? ((void)0) : (LOGE("ASSERT FAILED (%s:%d): %s\n", \
-        __FILE__, __LINE__, #x), *(int*)39=39, 0) )
+        __FILE__, __LINE__, #x), *(int*)39=39, (void)0) )
 #endif
 
+#define MIN(x,y) (((x) < (y)) ? (x) : (y))
+#define MAX(x,y) (((x) > (y)) ? (x) : (y))
+
+#define LIKELY(exp) (__builtin_expect((exp) != 0, true))
+#define UNLIKELY(exp) (__builtin_expect((exp) != 0, false))
 
 /*
  * If "very verbose" logging is enabled, make it equivalent to LOGV.
@@ -97,11 +102,15 @@ typedef union JValue {
 } JValue;
 
 /*
- * Some systems might have this in <stdbool.h>.
+ * The <stdbool.h> definition uses _Bool, a type known to the compiler.
  */
-#ifndef __bool_true_false_are_defined
+#ifdef HAVE_STDBOOL_H
+# include <stdbool.h>   /* C99 */
+#else
+# ifndef __bool_true_false_are_defined
 typedef enum { false=0, true=!false } bool;
-#define __bool_true_false_are_defined 1
+# define __bool_true_false_are_defined 1
+# endif
 #endif
 
 #define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))