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_STD_BITWISECASTREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_DETAIL_STD_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
35  ipReal32
36  act(const TIn& in)
37  {
38  return *reinterpret_cast<const ipReal32*>(&in);
39  }
40 
41  static IPSDK_FORCEINLINE
42  void
43  act(const TIn& in,
44  ipReal32& out)
45  {
46  out = *reinterpret_cast<const ipReal32*>(&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
56  ipReal64
57  act(const TIn& in)
58  {
59  return *reinterpret_cast<const ipReal64*>(&in);
60  }
61 
62  static IPSDK_FORCEINLINE
63  void
64  act(const TIn& in,
65  ipReal64& out)
66  {
67  out = *reinterpret_cast<const ipReal64*>(&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  TOut act(const ipReal32& in)
78  {
79  return *reinterpret_cast<const TOut*>(&in);
80  }
81 
82  static IPSDK_FORCEINLINE
83  void
84  act(const ipReal32& in,
85  TOut& out)
86  {
87  out = *reinterpret_cast<const TOut*>(&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  TOut act(const ipReal64& in)
98  {
99  return *reinterpret_cast<const TOut*>(&in);
100  }
101 
102  static IPSDK_FORCEINLINE
103  void
104  act(const ipReal64& in,
105  TOut& out)
106  {
107  out = *reinterpret_cast<const TOut*>(&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_STD_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
compiler optimisations only
Definition: InstructionSetTypes.h:34
float ipReal32
Base types definition.
Definition: BaseTypes.h:56