[libc-commits] [PATCH] D132184: [libc] add division to UInt

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Aug 23 01:52:10 PDT 2022


sivachandra added inline comments.


================
Comment at: libc/src/__support/CPP/UInt.h:41
+  // Construct a UInt from a C array.
+  template <size_t N> constexpr UInt(const uint64_t (&nums)[N]) {
+    size_t min_wordcount = N > WordCount ? N : WordCount;
----------------
michaelrj wrote:
> lntue wrote:
> > sivachandra wrote:
> > > Not sure if there is a need to initialize from a bigger array. If not, can we restrict this constructor with `enable_if`?
> > I think a better option that you're looking for is an implicit constructors / assignment from `UInt<M>` to `UInt<N>` with `M <= N`
> Re: sivachandra, we can't use `enable_if` here because `typetraits.h` depends on `UInt.h`.
> Re: lntue: I've added that as well, since it's also useful, but I need the ability to initialize from a C array as well.
Considering that we are moving to make the `CPP` directory a strict subset of the C++ standard library, we should move the `is_integral` specialization for `UInt` to this file or may be to `UInt128.h`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132184



More information about the libc-commits mailing list