/* * Copyright 2018 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkTo_DEFINED #define SkTo_DEFINED #include "include/core/SkTypes.h" #include "include/private/SkTFitsIn.h" template constexpr D SkTo(S s) { return SkASSERT(SkTFitsIn(s)), static_cast(s); } template constexpr int8_t SkToS8(S x) { return SkTo(x); } template constexpr uint8_t SkToU8(S x) { return SkTo(x); } template constexpr int16_t SkToS16(S x) { return SkTo(x); } template constexpr uint16_t SkToU16(S x) { return SkTo(x); } template constexpr int32_t SkToS32(S x) { return SkTo(x); } template constexpr uint32_t SkToU32(S x) { return SkTo(x); } template constexpr int SkToInt(S x) { return SkTo(x); } template constexpr unsigned SkToUInt(S x) { return SkTo(x); } template constexpr size_t SkToSizeT(S x) { return SkTo(x); } #endif // SkTo_DEFINED