IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
FloorReg.h
Go to the documentation of this file.
1 // FloorReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_COMMON_FLOORREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_COMMON_FLOORREG_H__
17 
21 #include <IPSDKUtil/InstructionSet/Arithmetic/detail/ConditionalAddReg.h>
22 #include <IPSDKUtil/InstructionSet/Arithmetic/detail/RoundToEvenReg.h>
25 
26 namespace ipsdk {
27 namespace simd {
28 namespace detail {
29 
32 
34 template <eInstructionSet::domain IS>
35 struct FloorReg<IS, ipReal32>
36 {
37  static IPSDK_FORCEINLINE
39  act(const typename RegType<IS, ipReal32>::Type& in)
40  {
41  typename RegType<IS, ipReal32>::Type out;
42  act(in, out);
43  return out;
44  }
45 
46  static IPSDK_FORCEINLINE
47  void
48  act(const typename RegType<IS, ipReal32>::Type& in,
49  typename RegType<IS, ipReal32>::Type& out)
50  {
51  typedef typename RegType<IS, ipReal32>::Type Reg;
52  Reg inRoundToEven;
53  RoundToEvenReg<IS, ipReal32>::act(in, inRoundToEven);
54  typename RegMaskType<IS, ipReal32>::Type inRoundToEvenGTIn;
55  IsGreaterReg<IS, ipReal32>::act(inRoundToEven, in, inRoundToEvenGTIn);
56  ConditionalAddReg<IS, ipReal32>::act(inRoundToEvenGTIn, inRoundToEven, -1.0f, out);
57  }
58 };
59 
61 template <eInstructionSet::domain IS>
62 struct FloorReg<IS, ipReal64>
63 {
64  static IPSDK_FORCEINLINE
66  act(const typename RegType<IS, ipReal64>::Type& in)
67  {
68  typename RegType<IS, ipReal64>::Type out;
69  act(in, out);
70  return out;
71  }
72 
73  static IPSDK_FORCEINLINE
74  void
75  act(const typename RegType<IS, ipReal64>::Type& in,
76  typename RegType<IS, ipReal64>::Type& out)
77  {
78  typedef typename RegType<IS, ipReal64>::Type Reg;
79  typedef typename RegMaskType<IS, ipReal64>::Type RegMask;
80  Reg inRoundToEven;
81  RoundToEvenReg<IS, ipReal64>::act(in, inRoundToEven);
82  RegMask inRoundToEvenGTIn;
83  IsGreaterReg<IS, ipReal64>::act(inRoundToEven, in, inRoundToEvenGTIn);
84  ConditionalAddReg<IS, ipReal64>::act(inRoundToEvenGTIn, inRoundToEven, -1.0f, out);
85  }
86 };
87 
90 
91 } // end of namespace detail
92 } // end of namespace simd
93 } // end of namespace ipsdk
94 
95 #endif // __IPSDKUTIL_INSTRUCTIONSET_ARITHMETIC_DETAIL_COMMON_FLOORREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
Definition: IsGreaterRegDecl.h:30
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
template structure which is specialized to implement the computation of value rounded to closest even...
Definition: FloorReg.h:36
RegType class.
Definition: ConditionalAddReg.h:36
RegMaskType class.
Definition of import/export macro for library.
template structure which is specialized to implement the computation of value rounded to closest even...
Definition: RoundToEvenReg.h:36
Definition: RegMaskType.h:29
Definition: RegType.h:29
float ipReal32
Base types definition.
Definition: BaseTypes.h:56