summaryrefslogtreecommitdiff
path: root/external/skia/constexpr-debug-std-max.patch.1
blob: 03a549c8fd4a610c21bbb977add509f3ba0d78ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff --git a/src/sksl/SkSLASTNode.h b/src/sksl/SkSLASTNode.h
index e6d3015d33..d95b43a778 100644
--- a/src/sksl/SkSLASTNode.h
+++ b/src/sksl/SkSLASTNode.h
@@ -18,6 +18,18 @@
 
 namespace SkSL {
 
+namespace {
+template<typename T>
+constexpr T skia_max( std::initializer_list<T> list )
+{
+T max = *list.begin();
+for(auto i: list)
+    if( max < i )
+        max = i;
+return max;
+}
+}
+
 /**
  * Represents a node in the abstract syntax tree (AST). The AST is based directly on the parse tree;
  * it is a parsed-but-not-yet-analyzed version of the program.
@@ -251,7 +263,7 @@ struct ASTNode {
     };
 
     struct NodeData {
-        char fBytes[std::max({sizeof(Token::Kind),
+        char fBytes[skia_max({sizeof(Token::Kind),
                               sizeof(StringFragment),
                               sizeof(bool),
                               sizeof(SKSL_INT),