OmniSciDB  c07336695a
BufferCompaction.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 /*
18  * @file BufferCompaction.h
19  * @author Minggang Yu <miyu@mapd.com>
20  * @brief Macros and functions for groupby buffer compaction
21  *
22  * Copyright (c) 2016 MapD Technologies, Inc. All rights reserved.
23  */
24 
25 #ifndef BUFFER_COMPACTION_H
26 #define BUFFER_COMPACTION_H
27 
28 #include <cstdint>
29 #include "../Shared/funcannotations.h"
30 
31 #ifndef __CUDACC__
32 #include <algorithm>
33 #endif
34 
35 constexpr int8_t MAX_BYTE_WIDTH_SUPPORTED = 8;
36 
37 #ifndef __CUDACC__
38 inline unsigned compact_byte_width(unsigned qw, unsigned low_bound) {
39  return std::max(qw, low_bound);
40 }
41 #endif
42 
43 template <typename T>
45  addr += sizeof(int64_t) - 1;
46  return (T)(((uint64_t)addr >> 3) << 3);
47 }
48 
49 #endif /* BUFFER_COMPACTION_H */
unsigned compact_byte_width(unsigned qw, unsigned low_bound)
#define DEVICE
#define HOST
#define FORCE_INLINE
constexpr int8_t MAX_BYTE_WIDTH_SUPPORTED
FORCE_INLINE HOST DEVICE T align_to_int64(T addr)