Commit 5f77c5e5 by Nicolas Capens Committed by Nicolas Capens

Add type-safe LValue<T> load and store methods

These methods operate on RValue<T> types so they're safer than 'loadValue()' and 'storeValue()'. They also enable overloading the latter in subsequent changes. Bug: b/155302798 Change-Id: I30903fc70e353dfd668873122ad7d8f74e857420 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/44669 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Result: kokoro <noreply+kokoro@google.com>
parent 67cdce99
......@@ -145,6 +145,18 @@ public:
RValue<Pointer<T>> operator&();
RValue<T> load() const
{
return RValue<T>(Variable::loadValue());
}
RValue<T> store(RValue<T> rvalue) const
{
Variable::storeValue(rvalue.value);
return rvalue;
}
Type *getType() const override
{
return T::type();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment