[libc-commits] [PATCH] D138182: [libc] Add sub_with_borrow to builtin_wrapper.h

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Nov 17 15:42:40 PST 2022


lntue added inline comments.


================
Comment at: libc/src/__support/builtin_wrappers.h:127
+    cpp::is_integral_v<T> && cpp::is_unsigned_v<T>, T>
+sub_with_borrow(T a, T b, T borrow_in, T &borrow_out) {
+  T tmp = a - b;
----------------
sivachandra wrote:
> Why not use `number_pair` for the return value?
Since these are kind of built-in wrappers, I want to kind of preserve how the builtins are defined.  Also the `number_pair` for subtraction is actually a bit odd, since then the carry/borrow/high part is actually of negative sign, while the result/low part is of positive sign.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138182



More information about the libc-commits mailing list