~pocl/pocl/trunk

« back to all changes in this revision

Viewing changes to lib/kernel/vecmathlib-pocl/fast_length.cl

  • Committer: Erik Schnetter
  • Date: 2013-08-17 16:11:57 UTC
  • Revision ID: eschnetter@perimeterinstitute.ca-20130817161157-pco7u3hv98nbg2uk
Move pocl-specific Vecmathlib code into a separate subdirectory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Note: Chapter 6.12.5 of the OpenCL standard says to use half_sqrt,
 
2
// not fast_sqrt
 
3
 
 
4
__attribute__((__overloadable__))
 
5
float fast_length(float p)
 
6
{
 
7
  return half_sqrt(dot(p, p));
 
8
}
 
9
 
 
10
__attribute__((__overloadable__))
 
11
float fast_length(float2 p)
 
12
{
 
13
  return half_sqrt(dot(p, p));
 
14
}
 
15
 
 
16
__attribute__((__overloadable__))
 
17
float fast_length(float3 p)
 
18
{
 
19
  return half_sqrt(dot(p, p));
 
20
}
 
21
 
 
22
__attribute__((__overloadable__))
 
23
float fast_length(float4 p)
 
24
{
 
25
  return half_sqrt(dot(p, p));
 
26
}