[libc-commits] [libc] [libc] Implement strfromd() and strfroml() (PR #86113)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Fri Mar 22 10:31:07 PDT 2024


================
@@ -0,0 +1,44 @@
+//===-- 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/stdlib/strfroml.h"
+#include "src/stdlib/str_from_util.h"
+
+#include <stdarg.h>
+#include <stddef.h>
+
+namespace LIBC_NAMESPACE {
+
+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);
+  section.length_modifier = printf_core::LengthModifier::L;
----------------
michaelrj-google wrote:

nit: Add a comment here to mark that this is different from the others.

https://github.com/llvm/llvm-project/pull/86113


More information about the libc-commits mailing list