IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
BitwiseAndReg.h
Go to the documentation of this file.
1 // BitwiseAndReg.h:
3 // -------------------
4 //
14 
15 #ifndef __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_STD_BITWISEANDREG_H__
16 #define __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_STD_BITWISEANDREG_H__
17 
21 
22 namespace ipsdk {
23 namespace simd {
24 namespace detail {
25 
28 
29 template <typename T>
31 {
32  static IPSDK_FORCEINLINE
33  T
34  act(const T& in1, const T& in2)
35  {
36  return in1 & in2;
37  }
38 
39  static IPSDK_FORCEINLINE
40  void
41  act(const T& in1, const T& in2, T& out)
42  {
43  out = in1 & in2;
44  }
45 };
46 
47 template <>
49 {
50  static IPSDK_FORCEINLINE
51  ipReal32
52  act(const ipReal32& in1,
53  const ipReal32& in2)
54  {
55  const ipUInt32 in1Cvt = *reinterpret_cast<const ipUInt32*>(&in1);
56  const ipUInt32 in2Cvt = *reinterpret_cast<const ipUInt32*>(&in2);
57  const ipUInt32 nRes = in1Cvt & in2Cvt;
58  return *reinterpret_cast<const ipReal32*>(&nRes);
59  }
60 
61  static IPSDK_FORCEINLINE
62  void
63  act(const ipReal32& in1,
64  const ipReal32& in2,
65  ipReal32& out)
66  {
67  const ipUInt32 in1Cvt = *reinterpret_cast<const ipUInt32*>(&in1);
68  const ipUInt32 in2Cvt = *reinterpret_cast<const ipUInt32*>(&in2);
69  const ipUInt32 nRes = in1Cvt & in2Cvt;
70  out = *reinterpret_cast<const ipReal32*>(&nRes);
71  }
72 };
73 
74 template <>
76 {
77  static IPSDK_FORCEINLINE
78  ipReal64
79  act(const ipReal64& in1,
80  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,
91  const ipReal64& in2,
92  ipReal64& out)
93  {
94  const ipUInt64 in1Cvt = *reinterpret_cast<const ipUInt64*>(&in1);
95  const ipUInt64 in2Cvt = *reinterpret_cast<const ipUInt64*>(&in2);
96  const ipUInt64 nRes = in1Cvt & in2Cvt;
97  out = *reinterpret_cast<const ipReal64*>(&nRes);
98  }
99 };
100 
103 
104 } // end of namespace detail
105 } // end of namespace simd
106 } // end of namespace ipsdk
107 
108 #endif // __IPSDKUTIL_INSTRUCTIONSET_LOGICAL_DETAIL_STD_BITWISEANDREG_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 of import/export macro for library.
compiler optimisations only
Definition: InstructionSetTypes.h:34
Definition: BitwiseAndReg.h:30
float ipReal32
Base types definition.
Definition: BaseTypes.h:56
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53