Buckets:
arudradey/fullhtml-storage / emsdk /upstream /emscripten /system /lib /llvm-libc /src /stdlib /strfroml.cpp
| //===-- Implementation of strfroml ------------------------------*- C++ -*-===// | |
| // | |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | |
| // See https://llvm.org/LICENSE.txt for license information. | |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
| // | |
| //===----------------------------------------------------------------------===// | |
| namespace LIBC_NAMESPACE_DECL { | |
| LLVM_LIBC_FUNCTION(int, strfroml, | |
| (char *__restrict s, size_t n, const char *__restrict format, | |
| long double fp)) { | |
| LIBC_ASSERT(s != nullptr); | |
| printf_core::FormatSection section = | |
| internal::parse_format_string(format, fp); | |
| // To ensure that the conversion function actually uses long double, | |
| // the length modifier has to be set to LenghtModifier::L | |
| section.length_modifier = printf_core::LengthModifier::L; | |
| printf_core::WriteBuffer<printf_core::Mode< | |
| printf_core::WriteMode::FILL_BUFF_AND_DROP_OVERFLOW>::value> | |
| wb(s, (n > 0 ? n - 1 : 0)); | |
| printf_core::Writer writer(wb); | |
| int result = 0; | |
| if (section.has_conv) | |
| result = internal::strfromfloat_convert<long double>(&writer, section); | |
| else | |
| result = writer.write(section.raw_string); | |
| if (result < 0) | |
| return result; | |
| if (n > 0) | |
| wb.buff[wb.buff_cur] = '\0'; | |
| return writer.get_chars_written(); | |
| } | |
| } // namespace LIBC_NAMESPACE_DECL | |
Xet Storage Details
- Size:
- 1.5 kB
- Xet hash:
- e432229a32951035ba304855733411f7a8bd6a1b6bd8fb84cefcec3435a25bc6
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.