|
| 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 | + |
| 18 | +// On platforms whose long double lacks an 80-bit mantissa (LDBL_MANT_DIG != 64), |
| 19 | +// wide_integer_impl.h emulates the from-double intermediate type with |
| 20 | +// boost::multiprecision::cpp_bin_float_double_extended. Making that include part |
| 21 | +// of every TU's closure costs ~4.3MB of preprocessed text; instead, ordinary TUs |
| 22 | +// only see declarations of set_multiplier / wide_integer_from_builtin(double) |
| 23 | +// and this TU compiles the bodies once. The macro below switches |
| 24 | +// wide_integer_impl.h into "definitions inline here" mode. |
| 25 | +#define DORIS_WIDE_INTEGER_FROM_DOUBLE_IMPL_TU |
| 26 | + |
| 27 | +#include "core/wide_integer.h" |
| 28 | + |
| 29 | +#if !(LDBL_MANT_DIG == 64) |
| 30 | + |
| 31 | +// Every wide::integer specialization used by Doris (see core/extended_types.h) |
| 32 | +// gets its from-double conversion emitted here. A new specialization that is |
| 33 | +// constructed from double elsewhere will fail at link time — add it below. |
| 34 | +template void wide::integer<128, signed>::_impl::wide_integer_from_builtin( |
| 35 | + wide::integer<128, signed>&, double) noexcept; |
| 36 | +template void wide::integer<128, unsigned>::_impl::wide_integer_from_builtin( |
| 37 | + wide::integer<128, unsigned>&, double) noexcept; |
| 38 | +template void wide::integer<256, signed>::_impl::wide_integer_from_builtin( |
| 39 | + wide::integer<256, signed>&, double) noexcept; |
| 40 | +template void wide::integer<256, unsigned>::_impl::wide_integer_from_builtin( |
| 41 | + wide::integer<256, unsigned>&, double) noexcept; |
| 42 | + |
| 43 | +#endif // !(LDBL_MANT_DIG == 64) |
0 commit comments