[libc-commits] [PATCH] D151935: [libc] Add strtoint32 and strtoint64 tests

Michael Jones via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Jun 1 15:03:52 PDT 2023


michaelrj marked an inline comment as done.
michaelrj added inline comments.


================
Comment at: libc/test/src/stdlib/strtoint64_test.cpp:33
+                     int base) {
+  auto result = internal::strtointeger<uint64_t>(str, base);
+  if (result.has_error())
----------------
sivachandra wrote:
> Nit: Not sure if we want to call the internal function or if we should do something like:
> 
> ```
> if constexpr (cpp::is_same_v<int64_t, long>)
>   result = __llvm_libc::strtol(...);
> else
>   result = __llvm_libc::strtoll(...);
> ```
Neither `long` nor `long long` are guaranteed to be 64 bits, so I think it's safer to just template this with the specific bits we want.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151935



More information about the libc-commits mailing list