[libc-commits] [PATCH] D142495: [libc] add scanf current position conversion

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jan 25 06:57:43 PST 2023


lntue accepted this revision.
lntue added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libc/src/stdio/scanf_core/converter_utils.h:23-33
+constexpr char LIBC_INLINE to_lower(char a) { return a | 32; }
+
+constexpr LIBC_INLINE int b36_char_to_int(char input) {
+  if (internal::isdigit(input))
+    return input - '0';
+  if (internal::isalpha(input))
+    return to_lower(input) + 10 - 'a';
----------------
For consistency, can you keep `LIBC_INLINE` before return types in the definitions.


================
Comment at: libc/src/stdio/scanf_core/current_pos_converter.cpp:19
+namespace scanf_core {
+int convert_current_pos(Reader *reader, const FormatSection &to_conv) {
+  write_int_with_length(reader->chars_read(), to_conv);
----------------
This function is quite short.  Will it get more complicated later?  Otherwise you can inline it in the header instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142495/new/

https://reviews.llvm.org/D142495



More information about the libc-commits mailing list