28 lines · plain
1//===----------------------------------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#if __CLC_FPSIZE == 6410#define NAN_MASK 0x7ff8000000000000ul11#elif __CLC_FPSIZE == 3212#define NAN_MASK 0x7fc0000013#elif __CLC_FPSIZE == 1614#define NAN_MASK 0x7e0015#endif16 17_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_nan(__CLC_U_GENTYPE code) {18 const __CLC_U_GENTYPE mask = NAN_MASK;19 const __CLC_U_GENTYPE res = code | mask;20 return __CLC_AS_GENTYPE(res);21}22 23_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __clc_nan(__CLC_S_GENTYPE code) {24 return __clc_nan(__CLC_AS_U_GENTYPE(code));25}26 27#undef NAN_MASK28