summaryrefslogtreecommitdiffstats
path: root/src/mapi
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2020-03-06 14:35:02 -0500
committerMarek Olšák <[email protected]>2020-03-20 23:01:13 -0400
commit4ded23a4add49c887f764c221f1aab5e0019cee2 (patch)
tree7b31ceb7f10b977910f249607bdf3af6f7f190a4 /src/mapi
parent01a50e2493dec462b75e827fb09a815a67f027a0 (diff)
glthread: simplify printing safe_mul in gl_marshal.py
Reviewed-by: Timothy Arceri <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4124>
Diffstat (limited to 'src/mapi')
-rw-r--r--src/mapi/glapi/gen/gl_marshal.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mapi/glapi/gen/gl_marshal.py b/src/mapi/glapi/gen/gl_marshal.py
index 6403b75bbc6..d4bbcd44a48 100644
--- a/src/mapi/glapi/gen/gl_marshal.py
+++ b/src/mapi/glapi/gen/gl_marshal.py
@@ -37,6 +37,14 @@ header = """
#include "marshal.h"
#define COMPAT (ctx->API != API_OPENGL_CORE)
+
+static inline int safe_mul(int a, int b)
+{
+ if (a < 0 || b < 0) return -1;
+ if (a == 0 || b == 0) return 0;
+ if (a > INT_MAX / b) return -1;
+ return a * b;
+}
"""
@@ -68,14 +76,6 @@ class PrintCode(gl_XML.gl_print_base):
def printRealHeader(self):
print(header)
- print('static inline int safe_mul(int a, int b)')
- print('{')
- print(' if (a < 0 || b < 0) return -1;')
- print(' if (a == 0 || b == 0) return 0;')
- print(' if (a > INT_MAX / b) return -1;')
- print(' return a * b;')
- print('}')
- print()
def printRealFooter(self):
pass