summaryrefslogtreecommitdiff
path: root/assembler/brw_compat.h
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2013-01-19 11:49:11 +0000
committerDamien Lespiau <damien.lespiau@intel.com>2013-03-04 15:54:37 +0000
commit14146b403736b481cf4dc9b815372076fa3ba4e5 (patch)
tree4a4cf0b8ba1997b130adf587b802b0d410fa8644 /assembler/brw_compat.h
parent4ca1a04b859ed039a41d46891a3019d953ab1dc2 (diff)
assembler: Import ralloc from Mesa
This also add a new brw_compat.h that should help maintaining the diff between mesa's version and our as small as possible. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'assembler/brw_compat.h')
-rw-r--r--assembler/brw_compat.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/assembler/brw_compat.h b/assembler/brw_compat.h
new file mode 100644
index 00000000..93001905
--- /dev/null
+++ b/assembler/brw_compat.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/*
+ * To share code with mesa without having to do big modifications and still be
+ * able to sync files together at a later point, this file holds macros and
+ * types defined in mesa's core headers.
+ */
+
+#ifndef __BRW_COMPAT_H__
+#define __BRW_COMPAT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * * __builtin_expect macros
+ * */
+#if !defined(__GNUC__)
+# define __builtin_expect(x, y) (x)
+#endif
+
+#ifndef likely
+# ifdef __GNUC__
+# define likely(x) __builtin_expect(!!(x), 1)
+# define unlikely(x) __builtin_expect(!!(x), 0)
+# else
+# define likely(x) (x)
+# define unlikely(x) (x)
+# endif
+#endif
+
+#if (__GNUC__ >= 3)
+#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
+#else
+#define PRINTFLIKE(f, a)
+#endif
+
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
+#endif /* __BRW_COMPAT_H__ */