1 //===-- Definition of mbstate-----------------------------------*-- C++ -*-===// 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-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_LIBC_SRC___SUPPORT_MBSTATE_H 10 #define LLVM_LIBC_SRC___SUPPORT_MBSTATE_H 11 12 #include "hdr/types/char32_t.h" 13 #include "src/__support/common.h" 14 #include <stdint.h> 15 16 namespace LIBC_NAMESPACE_DECL { 17 namespace internal { 18 19 struct mbstate { 20 // store a partial codepoint (in UTF-32) 21 char32_t partial = 0; 22 23 /* 24 Progress towards a conversion 25 Increases with each push(...) until it reaches total_bytes 26 Decreases with each pop(...) until it reaches 0 27 */ 28 uint8_t bytes_stored = 0; 29 30 // Total number of bytes that will be needed to represent this character 31 uint8_t total_bytes = 0; 32 }; 33 34 } // namespace internal 35 } // namespace LIBC_NAMESPACE_DECL 36 37 #endif // LLVM_LIBC_SRC___SUPPORT_MBSTATE_H 38