diff --git a/cpp/include/cudf/fixed_point/fixed_point.hpp b/cpp/include/cudf/fixed_point/fixed_point.hpp index c8e2ac01f41..20246022d8e 100644 --- a/cpp/include/cudf/fixed_point/fixed_point.hpp +++ b/cpp/include/cudf/fixed_point/fixed_point.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. + * Copyright (c) 2020-2021, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ #include // add cuda namespace #include +#include #include #include @@ -550,22 +551,6 @@ class fixed_point { } }; // namespace numeric -/** @brief Function that converts Rep to `std::string` - * - * @tparam Rep Representation type - * @return String-ified Rep - */ -template -std::string print_rep() -{ - if (cuda::std::is_same::value) - return "int32_t"; - else if (cuda::std::is_same::value) - return "int64_t"; - else - return "unknown type"; -} - /** @brief Function for identifying integer overflow when adding * * @tparam Rep Type of integer to check for overflow on @@ -641,8 +626,8 @@ CUDA_HOST_DEVICE_CALLABLE fixed_point operator+(fixed_point(lhs.rescaled(scale)._value, rhs.rescaled(scale)._value) && - "fixed_point overflow of underlying representation type " + print_rep()); + assert(!addition_overflow(lhs.rescaled(scale)._value, rhs.rescaled(scale)._value) && + "fixed_point overflow"); #endif @@ -659,9 +644,8 @@ CUDA_HOST_DEVICE_CALLABLE fixed_point operator-(fixed_point(lhs.rescaled(scale)._value, rhs.rescaled(scale)._value) && - "fixed_point overflow of underlying representation type " + print_rep()); + assert(!subtraction_overflow(lhs.rescaled(scale)._value, rhs.rescaled(scale)._value) && + "fixed_point overflow"); #endif @@ -675,8 +659,7 @@ CUDA_HOST_DEVICE_CALLABLE fixed_point operator*(fixed_point(lhs._value, rhs._value) && - "fixed_point overflow of underlying representation type " + print_rep()); + assert(!multiplication_overflow(lhs._value, rhs._value) && "fixed_point overflow"); #endif @@ -691,8 +674,7 @@ CUDA_HOST_DEVICE_CALLABLE fixed_point operator/(fixed_point(lhs._value, rhs._value) && - "fixed_point overflow of underlying representation type " + print_rep()); + assert(!division_overflow(lhs._value, rhs._value) && "fixed_point overflow"); #endif