// Copyright 2019 The SwiftShader Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef rr_Traits_inl #define rr_Traits_inl namespace rr { // Non-specialized implementation of CToReactorPtr::cast() defaults to // returning a ConstantPointer for v. template Pointer CToReactorPtr::cast(const T *v) { return ConstantPointer(v); } // CToReactorPtr specialization for T types that have a CToReactorT<> // specialization. template Pointer> CToReactorPtr::value>>::cast(const T *v) { return type(v); } // CToReactorPtr specialization for void*. Pointer CToReactorPtr::cast(const void *v) { return ConstantPointer(v); } // CToReactorPtrT specialization for function pointer types. template Pointer CToReactorPtr::value>>::cast(T *v) { return ConstantPointer(v); } // CToReactor specialization for pointer types. template CToReactorPtrT::type> CToReactor::value>>::cast(T v) { return CToReactorPtr::cast(v); } // CToReactor specialization for enum types. template CToReactorT::type> CToReactor::value>>::cast(T v) { return CToReactor::cast(v); } } // namespace rr #endif // rr_Traits_inl