OmniSciDB
0264ff685a
CompareKeysInl.h
Go to the documentation of this file.
1
/*
2
* Copyright 2017 MapD Technologies, Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#pragma once
18
19
#ifdef __CUDACC__
20
#include "
GpuRtConstants.h
"
21
#else
22
#include "
RuntimeFunctions.h
"
23
#endif // __CUDACC__
24
#include <cstdlib>
25
#include "../Shared/funcannotations.h"
26
27
template
<
typename
T =
int
64_t>
28
inline
DEVICE
T
SUFFIX
(
get_invalid_key
)() {
29
return
EMPTY_KEY_64
;
30
}
31
32
template
<>
33
inline
DEVICE
int32_t
SUFFIX
(
get_invalid_key
)() {
34
return
EMPTY_KEY_32
;
35
}
36
37
#ifdef __CUDACC__
38
template
<
typename
T>
39
inline
__device__
bool
keys_are_equal
(
const
T
* key1,
40
const
T
* key2,
41
const
size_t
key_component_count) {
42
for
(
size_t
i = 0; i < key_component_count; ++i) {
43
if
(key1[i] != key2[i]) {
44
return
false
;
45
}
46
}
47
return
true
;
48
}
49
#else
50
#include <cstring>
51
52
template
<
typename
T>
53
inline
bool
keys_are_equal
(
const
T
* key1,
54
const
T
* key2,
55
const
size_t
key_component_count) {
56
return
memcmp(key1, key2, key_component_count *
sizeof
(
T
)) == 0;
57
}
58
#endif // __CUDACC__
EMPTY_KEY_64
#define EMPTY_KEY_64
Definition:
GpuRtConstants.h:29
keys_are_equal
bool keys_are_equal(const T *key1, const T *key2, const size_t key_component_count)
Definition:
CompareKeysInl.h:53
SUFFIX
#define SUFFIX(name)
Definition:
funcannotations.h:72
RuntimeFunctions.h
DEVICE
#define DEVICE
Definition:
funcannotations.h:20
get_invalid_key
DEVICE T SUFFIX() get_invalid_key()
Definition:
CompareKeysInl.h:28
GpuRtConstants.h
EMPTY_KEY_32
#define EMPTY_KEY_32
Definition:
GpuRtConstants.h:30
omnisci.dtypes.T
T
Definition:
dtypes.py:8
QueryEngine
CompareKeysInl.h
Generated on Tue Jan 26 2021 12:24:50 for OmniSciDB by
1.8.13