• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <clc/clc.h>
2#include "../clcmacro.h"
3
4/*
5 *log(x) = log2(x) * (1/log2(e))
6 */
7
8_CLC_OVERLOAD _CLC_DEF float log(float x)
9{
10    return log2(x) * (1.0f / M_LOG2E_F);
11}
12
13_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, log, float);
14
15#ifdef cl_khr_fp64
16
17#pragma OPENCL EXTENSION cl_khr_fp64 : enable
18
19_CLC_OVERLOAD _CLC_DEF double log(double x)
20{
21    return log2(x) * (1.0 / M_LOG2E);
22}
23
24_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, log, double);
25
26#endif // cl_khr_fp64
27