1b7e05c87SSiva Chandra Reddy //===-- Implementation of fegetexceptflag function ------------------------===// 2b7e05c87SSiva Chandra Reddy // 3b7e05c87SSiva Chandra Reddy // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4b7e05c87SSiva Chandra Reddy // See https://llvm.org/LICENSE.txt for license information. 5b7e05c87SSiva Chandra Reddy // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6b7e05c87SSiva Chandra Reddy // 7b7e05c87SSiva Chandra Reddy //===----------------------------------------------------------------------===// 8b7e05c87SSiva Chandra Reddy 9b7e05c87SSiva Chandra Reddy #include "src/fenv/fegetexceptflag.h" 1075bbf4ddSJob Henandez Lara #include "hdr/types/fexcept_t.h" 1176ec69a9STue Ly #include "src/__support/FPUtil/FEnvImpl.h" 12b7e05c87SSiva Chandra Reddy #include "src/__support/common.h" 13*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h" 14b7e05c87SSiva Chandra Reddy 15*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL { 16b7e05c87SSiva Chandra Reddy 17b7e05c87SSiva Chandra Reddy LLVM_LIBC_FUNCTION(int, fegetexceptflag, (fexcept_t * flagp, int excepts)) { 1880deb826SRobin Caloudis static_assert(sizeof(int) >= sizeof(fexcept_t), 1980deb826SRobin Caloudis "fexcept_t value cannot fit in an int value."); 201c92911eSMichael Jones *flagp = static_cast<fexcept_t>(fputil::test_except(FE_ALL_EXCEPT) & excepts); 21b7e05c87SSiva Chandra Reddy return 0; 22b7e05c87SSiva Chandra Reddy } 23b7e05c87SSiva Chandra Reddy 24*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL 25