IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BitwiseOrReg.h
Go to the documentation of this file.
1 // BitwiseOrReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_STD_BITWISEORREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_STD_BITWISEORREG_H__
17 
21 
22 namespace ipsdk {
23 namespace simd {
24 namespace detail {
25 
28 
29 template <typename T>
30 struct BitwiseOrReg<
32  T,
33  typename boost::enable_if_c<boost::is_integral<T>::value>::type>
34 {
35  static IPSDK_FORCEINLINE
36  T
37  act(const T& in1, const T& in2)
38  {
39  return in1 | in2;
40  }
41 
42  static IPSDK_FORCEINLINE
43  void
44  act(const T& in1, const T& in2, T& out)
45  {
46  out = in1 | in2;
47  }
48 };
49 
50 template <>
52 {
53  static IPSDK_FORCEINLINE
54  ipReal32
55  act(const ipReal32& in1, const ipReal32& in2)
56  {
57  const ipUInt32 in1Cvt = *reinterpret_cast<const ipUInt32*>(&in1);
58  const ipUInt32 in2Cvt = *reinterpret_cast<const ipUInt32*>(&in2);
59  const ipUInt32 nRes = in1Cvt | in2Cvt;
60  return *reinterpret_cast<const ipReal32*>(&nRes);
61  return in1;
62  }
63 
64  static IPSDK_FORCEINLINE
65  void
66  act(const ipReal32& in1, const ipReal32& in2, ipReal32& out)
67  {
68  const ipUInt32 in1Cvt = *reinterpret_cast<const ipUInt32*>(&in1);
69  const ipUInt32 in2Cvt = *reinterpret_cast<const ipUInt32*>(&in2);
70  const ipUInt32 nRes = in1Cvt | in2Cvt;
71  out = *reinterpret_cast<const ipReal32*>(&nRes);
72  }
73 };
74 
75 template <>
77 {
78  static IPSDK_FORCEINLINE
79  ipReal64
80  act(const ipReal64& in1, const ipReal64& in2)
81  {
82  const ipUInt64 in1Cvt = *reinterpret_cast<const ipUInt64*>(&in1);
83  const ipUInt64 in2Cvt = *reinterpret_cast<const ipUInt64*>(&in2);
84  const ipUInt64 nRes = in1Cvt | in2Cvt;
85  return *reinterpret_cast<const ipReal64*>(&nRes);
86  }
87 
88  static IPSDK_FORCEINLINE
89  void
90  act(const ipReal64& in1, const ipReal64& in2, ipReal64& out)
91  {
92  const ipUInt64 in1Cvt = *reinterpret_cast<const ipUInt64*>(&in1);
93  const ipUInt64 in2Cvt = *reinterpret_cast<const ipUInt64*>(&in2);
94  const ipUInt64 nRes = in1Cvt | in2Cvt;
95  out = *reinterpret_cast<const ipReal64*>(&nRes);
96  }
97 };
98 
101 
102 } // end of namespace detail
103 } // end of namespace simd
104 } // end of namespace ipsdk
105 
106 #endif // __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_STD_BITWISEORREG_H__
Defines the IPSDK_FORCEINLINE.
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
uint64_t ipUInt64
Base types definition.
Definition: BaseTypes.h:55
double ipReal64
Base types definition.
Definition: BaseTypes.h:57
eInstructionSet
Enumerate for processor instruction set description.
Definition: InstructionSetTypes.h:31
Definition: BitwiseOrReg.h:30
Definition of import/export macro for library.
compiler optimisations only
Definition: InstructionSetTypes.h:34
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53