]> git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/cpp/src/arrow/util/int128_internal.h
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / cpp / src / arrow / util / int128_internal.h
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 #pragma once
18
19 #include "arrow/util/config.h"
20 #include "arrow/util/macros.h"
21
22 #ifndef ARROW_USE_NATIVE_INT128
23 #include <boost/multiprecision/cpp_int.hpp>
24 #endif
25
26 namespace arrow {
27 namespace internal {
28
29 // NOTE: __int128_t and boost::multiprecision::int128_t are not interchangeable.
30 // For example, __int128_t does not have any member function, and does not have
31 // operator<<(std::ostream, __int128_t). On the other hand, the behavior of
32 // boost::multiprecision::int128_t might be surprising with some configs (e.g.,
33 // static_cast<uint64_t>(boost::multiprecision::uint128_t) might return
34 // ~uint64_t{0} instead of the lower 64 bits of the input).
35 // Try to minimize the usage of int128_t and uint128_t.
36 #ifdef ARROW_USE_NATIVE_INT128
37 using int128_t = __int128_t;
38 using uint128_t = __uint128_t;
39 #else
40 using boost::multiprecision::int128_t;
41 using boost::multiprecision::uint128_t;
42 #endif
43
44 } // namespace internal
45 } // namespace arrow