1//===-- runtime/Float128Math/scale.cpp ------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "math-entries.h"
10#include "numeric-template-specs.h"
11#include <limits>
12
13namespace Fortran::runtime {
14extern "C" {
15
16#if LDBL_MANT_DIG == 113 || HAS_FLOAT128
17F128Type RTDEF(Scale16)(F128Type x, std::int64_t p) {
18 auto ip{static_cast<int>(p)};
19 if (ip != p) {
20 ip = p < 0 ? std::numeric_limits<int>::min()
21 : std::numeric_limits<int>::max();
22 }
23 return LDEXPTy<F128Type>::compute(x, ip);
24}
25#endif
26
27} // extern "C"
28} // namespace Fortran::runtime
29

source code of flang/runtime/Float128Math/scale.cpp