File: Deprecated.h

package info (click to toggle)
veccore 0.8.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,968 kB
  • sloc: cpp: 2,894; ansic: 1,332; makefile: 2
file content (89 lines) | stat: -rw-r--r-- 1,819 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef VECCORE_BACKEND_DEPRECATED_H
#define VECCORE_BACKEND_DEPRECATED_H

#include "Interface.h"

// This file contains old interface functions implemented in terms
// of the new ones. This is necessary not to break user code. Once
// we decide if the names for the new interface are good and migrate
// code to the new names, then these can be safely removed after a
// version bump of the library.

namespace vecCore {

// old interface, scalar was added first, so is different than others...

template <typename T>
using Mask_v = typename TypeTraits<T>::MaskType;
template <typename T>
using Index_v = typename TypeTraits<T>::IndexType;

template <typename T>
struct ScalarType {
  using Type = typename TypeTraits<T>::ScalarType;
};

// Get/Set

template <typename T>
VECCORE_FORCE_INLINE
VECCORE_ATT_HOST_DEVICE
Scalar<T> LaneAt(const T &v, size_t i)
{
  return Get(v, i);
}

template <typename T>
VECCORE_FORCE_INLINE
VECCORE_ATT_HOST_DEVICE
void AssignLane(T &v, size_t i, Scalar<T> const val)
{
  Set(v, i, val);
}

// Load/Store

template <typename T>
VECCORE_FORCE_INLINE
VECCORE_ATT_HOST_DEVICE
T FromPtr(Scalar<T> const *ptr)
{
  T v;
  LoadStoreImplementation<T>::template Load(v, ptr);
  return v;
}

template <typename M>
VECCORE_FORCE_INLINE
VECCORE_ATT_HOST_DEVICE
void StoreMask(M const &mask, bool *ptr)
{
  LoadStoreImplementation<M>::template Store<bool>(mask, ptr);
}

// Masking

template <typename M>
bool MaskFull(const M &mask);
template <typename M>
bool MaskEmpty(const M &mask);

template <typename M>
VECCORE_FORCE_INLINE
VECCORE_ATT_HOST_DEVICE
bool MaskLaneAt(const M &mask, size_t i)
{
  return Get(mask, i);
}

template <typename T>
VECCORE_FORCE_INLINE
VECCORE_ATT_HOST_DEVICE
void AssignMaskLane(T &mask, size_t i, bool val)
{
  Set(mask, i, val);
}

} // namespace vecCore

#endif