1b854a232SRobin Caloudis //===-- Implementation of fetestexceptflag function -----------------------===// 2b854a232SRobin Caloudis // 3b854a232SRobin Caloudis // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4b854a232SRobin Caloudis // See https://llvm.org/LICENSE.txt for license information. 5b854a232SRobin Caloudis // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6b854a232SRobin Caloudis // 7b854a232SRobin Caloudis //===----------------------------------------------------------------------===// 8b854a232SRobin Caloudis 9b854a232SRobin Caloudis #include "src/fenv/fetestexceptflag.h" 10b854a232SRobin Caloudis #include "hdr/types/fexcept_t.h" 11b854a232SRobin Caloudis #include "src/__support/FPUtil/FEnvImpl.h" 12b854a232SRobin Caloudis #include "src/__support/common.h" 13*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h" 14b854a232SRobin Caloudis 15*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL { 16b854a232SRobin Caloudis 17b854a232SRobin Caloudis LLVM_LIBC_FUNCTION(int, fetestexceptflag, 18b854a232SRobin Caloudis (const fexcept_t *flagp, int excepts)) { 19b854a232SRobin Caloudis static_assert(sizeof(int) >= sizeof(fexcept_t), 20b854a232SRobin Caloudis "fexcept_t value cannot fit in an int value."); 21b854a232SRobin Caloudis return *flagp | fputil::test_except(excepts); 22b854a232SRobin Caloudis } 23b854a232SRobin Caloudis 24*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL 25