IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BitwiseCastReg.h
Go to the documentation of this file.
1 // BitwiseCastReg.h:
3 // ------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_DETAIL_SSE2_BITWISECASTREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_DETAIL_SSE2_BITWISECASTREG_H__
17 
21 
22 namespace ipsdk {
23 namespace simd {
24 namespace detail {
25 
28 
29 template <typename TIn>
31  typename boost::enable_if_c<boost::is_integral<TIn>::value && sizeof(TIn)==4>::type>
32 {
33 
34  static IPSDK_FORCEINLINE
36  act(const typename Sse2Type<TIn>::Type& in)
37  {
38  return _mm_castsi128_ps(in);
39  }
40 
41  static IPSDK_FORCEINLINE
42  void
43  act(const typename Sse2Type<TIn>::Type& in,
44  typename Sse2Type<ipReal32>::Type& out)
45  {
46  out = _mm_castsi128_ps(in);
47  }
48 };
49 
50 template <typename TIn>
52  typename boost::enable_if_c<boost::is_integral<TIn>::value && sizeof(TIn)==8>::type>
53 {
54 
55  static IPSDK_FORCEINLINE
57  act(const typename Sse2Type<TIn>::Type& in)
58  {
59  return _mm_castsi128_pd(in);
60  }
61 
62  static IPSDK_FORCEINLINE
63  void
64  act(const typename Sse2Type<TIn>::Type& in,
65  typename Sse2Type<ipReal64>::Type& out)
66  {
67  out = _mm_castsi128_pd(in);
68  }
69 };
70 
71 template <typename TOut>
73  typename boost::enable_if_c<boost::is_integral<TOut>::value && sizeof(TOut)==4>::type>
74 {
75 
76  static IPSDK_FORCEINLINE
77  typename Sse2Type<TOut>::Type act(const Sse2Type<ipReal32>::Type& in)
78  {
79  return _mm_castps_si128(in);
80  }
81 
82  static IPSDK_FORCEINLINE
83  void
84  act(const Sse2Type<ipReal32>::Type& in,
85  typename Sse2Type<TOut>::Type& out)
86  {
87  out = _mm_castps_si128(in);
88  }
89 };
90 
91 template <typename TOut>
93  typename boost::enable_if_c<boost::is_integral<TOut>::value && sizeof(TOut)==8>::type>
94 {
95 
96  static IPSDK_FORCEINLINE
97  typename Sse2Type<TOut>::Type act(const Sse2Type<ipReal64>::Type& in)
98  {
99  return _mm_castpd_si128(in);
100  }
101 
102  static IPSDK_FORCEINLINE
103  void
104  act(const Sse2Type<ipReal64>::Type& in,
105  typename Sse2Type<TOut>::Type& out)
106  {
107  out = _mm_castpd_si128(in);
108  }
109 };
110 
113 
114 } // end of namespace detail
115 } // end of namespace simd
116 } // end of namespace ipsdk
117 
118 #endif // __IPSDKUTIL_INSTRUCTIONSET_DETAIL_SSE2_BITWISECASTREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Definition of import/export macro for library.
Definition: BitwiseCastReg.h:29
Streaming SIMD Extensions 2.
Definition: InstructionSetTypes.h:36
structure used to retrieve SSE2 type associated to a base type
Definition: Sse2Types.h:32
float ipReal32
Base types definition.
Definition: BaseTypes.h:56