Skip to content
Snippets Groups Projects
sfx-math.cuh 692 B
Newer Older
  • Learn to ignore specific revisions
  • 数学の武士's avatar
    数学の武士 committed
    #pragma once
    #ifdef INCLUDE_CUDA
        #include <cuda.h>
        #include <cuda_runtime_api.h>
        #define FUCNTION_DECLARATION_SPECIFIER __host__ __device__
    #else
        #define FUCNTION_DECLARATION_SPECIFIER
    #endif
    
    namespace sfx_math
    {
        template<typename T>
        FUCNTION_DECLARATION_SPECIFIER T min(const T a, const T b);
    
        template<typename T>
        FUCNTION_DECLARATION_SPECIFIER T max(const T a, const T b);
    }
    
    template<typename T>
    FUCNTION_DECLARATION_SPECIFIER T sfx_math::min(const T a, const T b)
    {
        if(a > b)
            return b;
        return a;
    }
    
    template<typename T>
    FUCNTION_DECLARATION_SPECIFIER T sfx_math::max(const T a, const T b)
    {
        if(a > b)
            return a;
        return b;
    }