summaryrefslogtreecommitdiffstats
path: root/pocl/fast_length.cl
blob: eb765b97cd3fff257dbcff7ee02f943e0222543c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Note: Chapter 6.12.5 of the OpenCL standard says to use half_sqrt,
// not fast_sqrt

__attribute__((__overloadable__))
float fast_length(float p)
{
  return half_sqrt(dot(p, p));
}

__attribute__((__overloadable__))
float fast_length(float2 p)
{
  return half_sqrt(dot(p, p));
}

__attribute__((__overloadable__))
float fast_length(float3 p)
{
  return half_sqrt(dot(p, p));
}

__attribute__((__overloadable__))
float fast_length(float4 p)
{
  return half_sqrt(dot(p, p));
}
OpenPOWER on IntegriCloud