diff --git a/src/include/OpenImageIO/fmath.h b/src/include/OpenImageIO/fmath.h index ea31eb43ce..6db6376f08 100644 --- a/src/include/OpenImageIO/fmath.h +++ b/src/include/OpenImageIO/fmath.h @@ -911,20 +911,11 @@ convert_type (const float *src, uint8_t *dst, size_t n, #if defined(_HALF_H_) || defined(IMATH_HALF_H_) +// Specialize for half only if half.h is included prior to fmath.h template<> -OIIO_UTIL_API -void convert_type (const half *src, float *dst, size_t n, - float /*_min*/, float /*_max*/); -template<> -OIIO_UTIL_API -void convert_type (const float *src, half *dst, size_t n, - half /*_min*/, half /*_max*/); - -#if OIIO_FMATH_HEADER_ONLY -// Not just the declarations, give the definitions here. -template<> -void convert_type (const half *src, float *dst, size_t n, - float /*_min*/, float /*_max*/) +inline void +convert_type (const half *src, float *dst, size_t n, + float /*_min*/, float /*_max*/) { #if OIIO_SIMD >= 8 && OIIO_F16C_ENABLED // If f16c ops are enabled, it's worth doing this by 8's @@ -944,7 +935,7 @@ void convert_type (const half *src, float *dst, size_t n, } template<> -void +inline void convert_type (const float *src, half *dst, size_t n, half /*_min*/, half /*_max*/) { @@ -964,7 +955,6 @@ convert_type (const float *src, half *dst, size_t n, while (n--) *dst++ = *src++; } -#endif /* if OIIO_FMATH_HEADER_ONLY */ #endif /* if defined(IMATH_HALF_H_) */ #endif /* ifndef __CUDA_ARCH__ */ diff --git a/src/libutil/CMakeLists.txt b/src/libutil/CMakeLists.txt index 2a159e449b..e7c6447c75 100644 --- a/src/libutil/CMakeLists.txt +++ b/src/libutil/CMakeLists.txt @@ -4,7 +4,7 @@ set (libOpenImageIO_Util_srcs argparse.cpp benchmark.cpp errorhandler.cpp farmhash.cpp filesystem.cpp - fmath.cpp filter.cpp hashes.cpp paramlist.cpp + filter.cpp hashes.cpp paramlist.cpp plugin.cpp SHA1.cpp strutil.cpp sysutil.cpp thread.cpp timer.cpp typedesc.cpp ustring.cpp xxhash.cpp) @@ -15,9 +15,6 @@ if (CMAKE_COMPILER_IS_GNUCC) endif () if (CMAKE_UNITY_BUILD) - # If unity builds are occurring, fmath.cpp MUST be compiled alone. But the - # rest can be built together if in group mode. - set_property (SOURCE fmath.cpp APPEND PROPERTY SKIP_UNITY_BUILD_INCLUSION TRUE) set_source_files_properties (${libOpenImageIO_Util_srcs} PROPERTIES UNITY_GROUP utilsrc) endif () diff --git a/src/libutil/fmath.cpp b/src/libutil/fmath.cpp deleted file mode 100644 index 647f60d5c7..0000000000 --- a/src/libutil/fmath.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright Contributors to the OpenImageIO project. -// SPDX-License-Identifier: Apache-2.0 -// https://github.com/AcademySoftwareFoundation/OpenImageIO - -#include - -// Force the full implementation of all fmath functions, which will compile -// some callable versions here. -#define OIIO_FMATH_HEADER_ONLY 1 - -#include