T-SIMD v31.1.0
A C++ template SIMD library
Loading...
Searching...
No Matches
backward_compat.H
1// ===========================================================================
2//
3// aliases for backward compatibility
4//
5// This source code file is part of the following software:
6//
7// - the low-level C++ template SIMD library
8// - the SIMD implementation of the MinWarping and the 2D-Warping methods
9// for local visual homing.
10//
11// The software is provided based on the accompanying license agreement in the
12// file LICENSE.md.
13// The software is provided "as is" without any warranty by the licensor and
14// without any liability of the licensor, and the software may not be
15// distributed by the licensee; see the license agreement for details.
16//
17// (C) Jonas Keller, Ralf Möller
18// Computer Engineering
19// Faculty of Technology
20// Bielefeld University
21// www.ti.uni-bielefeld.de
22//
23// ===========================================================================
24
25// 13. Feb 23 (Jonas Keller): added SIMDBackwardCompat.H for backward
26// compatibility of renamed types and functions
27
28// 09. Mar 23 (Jonas Keller): added doxygen documentation
29
35#pragma once
36#ifndef SIMD_BACKWARD_COMPAT_H_
37#define SIMD_BACKWARD_COMPAT_H_
38
39#include "defs.H"
40#include "types.H"
41#include "vec.H"
42#include "vecs.H"
43
49namespace simd {
50
51using SIMDByte = Byte;
53using SIMDWord = Word;
55using SIMDInt = Int;
57
64
66template <typename T, size_t SIMD_WIDTH_DEFAULT_NATIVE>
68
70template <size_t NUM, typename T, size_t SIMD_WIDTH_DEFAULT_NATIVE>
71using SIMDVecs = Vecs<NUM, T, SIMD_WIDTH>;
72
74template <typename T, size_t SIMD_WIDTH_DEFAULT_NATIVE>
76
78template <typename T>
80
82template <typename T>
84
86template <typename T>
88
90template <typename Tout, typename Tin>
91using NumSIMDVecs = NumVecs<Tout, Tin>;
92
94template <typename T, size_t SIMD_WIDTH>
95static SIMD_INLINE Vec<T, SIMD_WIDTH> and_(const Vec<T, SIMD_WIDTH> &a,
96 const Vec<T, SIMD_WIDTH> &b)
97{
98 return bit_and(a, b);
99}
100
102template <typename T, size_t SIMD_WIDTH>
103static SIMD_INLINE Vec<T, SIMD_WIDTH> or_(const Vec<T, SIMD_WIDTH> &a,
104 const Vec<T, SIMD_WIDTH> &b)
105{
106 return bit_or(a, b);
107}
108
110template <typename T, size_t SIMD_WIDTH>
111static SIMD_INLINE Vec<T, SIMD_WIDTH> xor_(const Vec<T, SIMD_WIDTH> &a,
112 const Vec<T, SIMD_WIDTH> &b)
113{
114 return bit_xor(a, b);
115}
116
118template <typename T, size_t SIMD_WIDTH>
119static SIMD_INLINE Vec<T, SIMD_WIDTH> not_(const Vec<T, SIMD_WIDTH> &a)
120{
121 return bit_not(a);
122}
123
125template <typename T, size_t SIMD_WIDTH>
126static SIMD_INLINE T elem0(const Vec<T, SIMD_WIDTH> &a)
127{
128 return extract<0>(a);
129}
130
132template <typename T, size_t SIMD_WIDTH>
133static constexpr SIMD_INLINE size_t numSIMDVecElements()
134{
136}
137
139template <typename Tout, typename Tin>
140static constexpr SIMD_INLINE size_t numInputSIMDVecs()
141{
142 return numInVecs<Tout, Tin>();
143}
144
146template <typename Tout, typename Tin>
147static constexpr SIMD_INLINE size_t numOutputSIMDVecs()
148{
149 return numOutVecs<Tout, Tin>();
150}
151
152} // namespace simd
153
156inline void *simd_aligned_malloc(size_t alignment, size_t size)
157{
158 return simd::aligned_malloc(alignment, size);
159}
160
163inline void simd_aligned_free(void *ptr)
164{
166}
167
170template <typename T, size_t ALIGN>
172
175// some IDEs don't see this if it comes first (compiles, but IDE has problems)
176// shifted here:
177
178#ifdef DOXYGEN
179// doxygen doesn't understand namespace aliases
185namespace ns_simd {}
186#else
187namespace ns_simd = simd;
188#endif
189
190#endif
SIMD mask class consisting of as many bits as the corresponding Vec has elements.
Definition vec.H:119
SIMD vector class, holds multiple elements of the same type.
Definition vec.H:75
void simd_aligned_free(void *ptr)
Definition backward_compat.H:163
void * simd_aligned_malloc(size_t alignment, size_t size)
Definition backward_compat.H:156
Aligned allocator.
Definition alloc.H:132
void * aligned_malloc(size_t alignment, size_t size)
Aligned memory allocation.
Definition alloc.H:61
void aligned_free(void *ptr)
Aligned memory deallocation.
Definition alloc.H:102
float Float
Single-precision floating point number (32-bit)
Definition types.H:56
int16_t Short
Signed 16-bit integer.
Definition types.H:53
int32_t Int
Signed 32-bit integer.
Definition types.H:54
uint16_t Word
Unsigned 16-bit integer.
Definition types.H:52
uint8_t Byte
Unsigned 8-bit integer.
Definition types.H:50
int8_t SignedByte
Signed 8-bit integer.
Definition types.H:51
static T extract(const Vec< T, SIMD_WIDTH > &a)
Extracts a single value from a Vec.
Definition base.H:1072
static Vec< T, SIMD_WIDTH > bit_and(const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
Computes the bitwise AND of two Vec's.
Definition base.H:732
static Vec< T, SIMD_WIDTH > bit_xor(const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
Computes the bitwise XOR of two Vec's.
Definition base.H:776
static Vec< T, SIMD_WIDTH > bit_or(const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
Computes the bitwise OR of two Vec's.
Definition base.H:746
static Vec< T, SIMD_WIDTH > bit_not(const Vec< T, SIMD_WIDTH > &a)
Computes the bitwise NOT of a Vec.
Definition base.H:789
static constexpr size_t numInVecs()
Number of input vectors for functions that potentially change the size of the elements but not the nu...
Definition vec.H:201
static constexpr size_t numOutVecs()
Number of output vectors for functions that potentially change the size of the elements but not the n...
Definition vec.H:216
Alias for simd.
Definition backward_compat.H:185
Namespace for T-SIMD.
Definition time_measurement.H:161
Float SIMDFloat
Alias for Float.
Definition backward_compat.H:56
static Vec< T, SIMD_WIDTH > not_(const Vec< T, SIMD_WIDTH > &a)
Alias for bit_not().
Definition backward_compat.H:119
SIMDSignedByte * SIMDSignedBytePtr
Pointer to SIMDSignedByte.
Definition backward_compat.H:59
Word SIMDWord
Alias for Word.
Definition backward_compat.H:53
Vecs< NUM, T, SIMD_WIDTH > SIMDVecs
Alias for Vecs.
Definition backward_compat.H:71
SIMDInt * SIMDIntPtr
Pointer to SIMDInt.
Definition backward_compat.H:62
Int SIMDInt
Alias for Int.
Definition backward_compat.H:55
Byte SIMDByte
Alias for Byte.
Definition backward_compat.H:51
NumVecs< Tout, Tin > NumSIMDVecs
Alias for NumVecs.
Definition backward_compat.H:91
static T elem0(const Vec< T, SIMD_WIDTH > &a)
Alias for extract<0>().
Definition backward_compat.H:126
Short SIMDShort
Alias for Short.
Definition backward_compat.H:54
static constexpr size_t numInputSIMDVecs()
Alias for numInVecs().
Definition backward_compat.H:140
static Vec< T, SIMD_WIDTH > xor_(const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
Alias for bit_xor().
Definition backward_compat.H:111
SIMDFloat * SIMDFloatPtr
Pointer to SIMDFloat.
Definition backward_compat.H:63
static Vec< T, SIMD_WIDTH > and_(const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
Alias for bit_and().
Definition backward_compat.H:95
static Vec< T, SIMD_WIDTH > or_(const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
Alias for bit_or().
Definition backward_compat.H:103
static constexpr size_t numSIMDVecElements()
Alias for Vec<T, SIMD_WIDTH>::elems.
Definition backward_compat.H:133
SIMDWord * SIMDWordPtr
Pointer to SIMDWord.
Definition backward_compat.H:60
SIMDByte * SIMDBytePtr
Pointer to SIMDByte.
Definition backward_compat.H:58
static constexpr size_t numOutputSIMDVecs()
Alias for numOutVecs().
Definition backward_compat.H:147
SIMDShort * SIMDShortPtr
Pointer to SIMDShort.
Definition backward_compat.H:61
SignedByte SIMDSignedByte
Alias for SignedByte.
Definition backward_compat.H:52
Class for formatting SIMD types as decimal numbers.
Definition types.H:379
Class for generating format strings for printf for SIMD types.
Definition types.H:340
Type information for SIMD types.
Definition types.H:257