16cd50e7bScgyurgyik //===-- Implementation of iscntrl------------------------------------------===//
26cd50e7bScgyurgyik //
36cd50e7bScgyurgyik // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
46cd50e7bScgyurgyik // See https://llvm.org/LICENSE.txt for license information.
56cd50e7bScgyurgyik // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66cd50e7bScgyurgyik //
76cd50e7bScgyurgyik //===----------------------------------------------------------------------===//
86cd50e7bScgyurgyik 
96cd50e7bScgyurgyik #include "src/ctype/iscntrl.h"
106cd50e7bScgyurgyik 
116cd50e7bScgyurgyik #include "src/__support/common.h"
126cd50e7bScgyurgyik 
136cd50e7bScgyurgyik namespace __llvm_libc {
146cd50e7bScgyurgyik 
156cd50e7bScgyurgyik // TODO: Currently restricted to default locale.
166cd50e7bScgyurgyik // These should be extended using locale information.
17a0b65a7bSMichael Jones LLVM_LIBC_FUNCTION(int, iscntrl, (int c)) {
18*9cdd4ea0SAlfonso Gregory   const unsigned char ch = static_cast<unsigned char>(c);
19*9cdd4ea0SAlfonso Gregory   return static_cast<int>(ch < 0x20 || ch == 0x7f);
206cd50e7bScgyurgyik }
216cd50e7bScgyurgyik 
226cd50e7bScgyurgyik } // namespace __llvm_libc
23