[PATCH] D21343: Implement `lcm` and `gcd` from library fundamentals V2

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 09:39:42 PDT 2016


mclow.lists updated this revision to Diff 60856.
mclow.lists added a comment.

Updated based on comments here and elsewhere.

- Do the abs once, rather than at every level of recursion
- Add tests for `bool`.
- Constexpr

Also, add an assertion to detect overflow in `lcm`.

I have not yet incorporated Eric's constexpr tests.


http://reviews.llvm.org/D21343

Files:
  include/experimental/numeric
  test/std/experimental/numeric/numeric.ops.overview/nothing_to_do.pass.cpp
  test/std/experimental/numeric/numeric.ops/nothing_to_do.pass.cpp
  test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral1.fail.cpp
  test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.not_integral2.fail.cpp
  test/std/experimental/numeric/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
  test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral1.fail.cpp
  test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.not_integral2.fail.cpp
  test/std/experimental/numeric/numeric.ops/numeric.ops.lcm/lcm.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21343.60856.patch
Type: text/x-patch
Size: 30547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160615/76f0cb0a/attachment-0001.bin>


More information about the cfe-commits mailing list