OSDN Git Service

Reactor: Fix cast from bool -> RValue<Bool>.
authorBen Clayton <bclayton@google.com>
Fri, 15 Mar 2019 10:06:06 +0000 (10:06 +0000)
committerBen Clayton <bclayton@google.com>
Fri, 15 Mar 2019 15:06:26 +0000 (15:06 +0000)
This was previously taking the IntLiteral<T> path, resulting in an integer type instead of a bool type.

Bug: b/128636885
Change-Id: I1a36a7ba0e7009431dc44645f90454d389be721b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/27250
Presubmit-Ready: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
src/Reactor/Reactor.hpp

index 956ca26..0664640 100644 (file)
@@ -126,17 +126,23 @@ namespace rr
        };
 
        template<class T>
-       struct IntLiteral
+       struct BoolLiteral
        {
                struct type;
        };
 
        template<>
-       struct IntLiteral<Bool>
+       struct BoolLiteral<Bool>
        {
                typedef bool type;
        };
 
+       template<class T>
+       struct IntLiteral
+       {
+               struct type;
+       };
+
        template<>
        struct IntLiteral<Int>
        {
@@ -174,6 +180,7 @@ namespace rr
                explicit RValue(Value *rvalue);
 
                RValue(const T &lvalue);
+               RValue(typename BoolLiteral<T>::type i);
                RValue(typename IntLiteral<T>::type i);
                RValue(typename FloatLiteral<T>::type f);
                RValue(const Reference<T> &rhs);
@@ -2396,6 +2403,12 @@ namespace rr
        }
 
        template<class T>
+       RValue<T>::RValue(typename BoolLiteral<T>::type i)
+       {
+               value = Nucleus::createConstantBool(i);
+       }
+
+       template<class T>
        RValue<T>::RValue(typename IntLiteral<T>::type i)
        {
                value = Nucleus::createConstantInt(i);