brintos

brintos / llvm-project-archived public Read only

0
0
Text · 739 B · 6bc7526 Raw
25 lines · cpp
1//===-- Implementation of btowc -------------------------------------------===//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#include "src/wchar/btowc.h"10#include "src/__support/common.h"11#include "src/__support/macros/config.h"12 13#include "hdr/types/wint_t.h"14#include "hdr/wchar_macros.h" // for WEOF.15 16namespace LIBC_NAMESPACE_DECL {17 18LLVM_LIBC_FUNCTION(wint_t, btowc, (int c)) {19  if (c > 127 || c < 0)20    return WEOF;21  return static_cast<wint_t>(c);22}23 24} // namespace LIBC_NAMESPACE_DECL25