From 4f2ecd53a9daaf88bb7d075745eefb6e2e4741e0 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 11 Jul 2018 18:11:13 +0200 Subject: Roll back to ANGLE/2845 --- .../src/compiler/preprocessor/ExpressionParser.y | 54 +++++----------------- 1 file changed, 12 insertions(+), 42 deletions(-) (limited to 'gfx/angle/src/compiler/preprocessor/ExpressionParser.y') diff --git a/gfx/angle/src/compiler/preprocessor/ExpressionParser.y b/gfx/angle/src/compiler/preprocessor/ExpressionParser.y index 4dbc9e828..dc0080eac 100755 --- a/gfx/angle/src/compiler/preprocessor/ExpressionParser.y +++ b/gfx/angle/src/compiler/preprocessor/ExpressionParser.y @@ -41,15 +41,17 @@ WHICH GENERATES THE GLSL ES preprocessor expression parser. #include #include -#include #include "DiagnosticsBase.h" #include "Lexer.h" #include "Token.h" -#include "common/mathutil.h" -typedef int32_t YYSTYPE; -typedef uint32_t UNSIGNED_TYPE; +#if defined(_MSC_VER) +typedef __int64 YYSTYPE; +#else +#include +typedef intmax_t YYSTYPE; +#endif // _MSC_VER #define YYENABLE_NLS 0 #define YYLTYPE_IS_TRIVIAL 1 @@ -194,7 +196,7 @@ expression $$ = $1 < $3; } | expression TOK_OP_RIGHT expression { - if ($3 < 0 || $3 > 31) + if ($3 < 0) { if (!context->isIgnoringErrors()) { @@ -208,18 +210,13 @@ expression } $$ = static_cast(0); } - else if ($1 < 0) - { - // Logical shift right. - $$ = static_cast(static_cast($1) >> $3); - } else { $$ = $1 >> $3; } } | expression TOK_OP_LEFT expression { - if ($3 < 0 || $3 > 31) + if ($3 < 0) { if (!context->isIgnoringErrors()) { @@ -233,21 +230,16 @@ expression } $$ = static_cast(0); } - else if ($1 < 0) - { - // Logical shift left. - $$ = static_cast(static_cast($1) << $3); - } else { $$ = $1 << $3; } } | expression '-' expression { - $$ = gl::WrappingDiff($1, $3); + $$ = $1 - $3; } | expression '+' expression { - $$ = gl::WrappingSum($1, $3); + $$ = $1 + $3; } | expression '%' expression { if ($3 == 0) @@ -264,12 +256,6 @@ expression } $$ = static_cast(0); } - else if (($1 == std::numeric_limits::min()) && ($3 == -1)) - { - // Check for the special case where the minimum representable number is - // divided by -1. If left alone this has undefined results. - $$ = 0; - } else { $$ = $1 % $3; @@ -290,20 +276,13 @@ expression } $$ = static_cast(0); } - else if (($1 == std::numeric_limits::min()) && ($3 == -1)) - { - // Check for the special case where the minimum representable number is - // divided by -1. If left alone this leads to integer overflow in C++, which - // has undefined results. - $$ = std::numeric_limits::max(); - } else { $$ = $1 / $3; } } | expression '*' expression { - $$ = gl::WrappingMul($1, $3); + $$ = $1 * $3; } | '!' expression %prec TOK_UNARY { $$ = ! $2; @@ -312,16 +291,7 @@ expression $$ = ~ $2; } | '-' expression %prec TOK_UNARY { - // Check for negation of minimum representable integer to prevent undefined signed int - // overflow. - if ($2 == std::numeric_limits::min()) - { - $$ = std::numeric_limits::min(); - } - else - { - $$ = -$2; - } + $$ = - $2; } | '+' expression %prec TOK_UNARY { $$ = + $2; -- cgit v1.2.3