Extract non-portability constexpr math functions to new header
authorYedidya Feldblum <yfeldblum@fb.com>
Thu, 31 Aug 2017 02:26:32 +0000 (19:26 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 31 Aug 2017 02:43:36 +0000 (19:43 -0700)
commit6d7c6d55f0f4b7b75607608ef9037db58083368f
treeadf19eb11f23d1729b782badfcaa10c61d7e243a
parent4717bdadf28139ef19b81315879892ed972fe7a5
Extract non-portability constexpr math functions to new header

Summary:
[Folly] Extract non-portability `constexpr` math functions to new header.

This new header, `folly/ConstexprMath.h`, is specifically for compile-time-computable math functions. We start with `min`, `max`, `abs`, and `log2`.

Included substantive changes:
* Add new tests for `constexpr_strlen`, which remains in the portability header.
* Make `constexpr_min` and `constexpr_max` variadic.
* Make `constexpr_log2` tail-recursive, remove `const_log2` in `FixedString.h`, and move the related comment.

Reviewed By: Orvid

Differential Revision: D5739715

fbshipit-source-id: 29d3cc846ce98bb4bdddcc8b0fa80e4d32075fe0
folly/ConstexprMath.h [new file with mode: 0644]
folly/FixedString.h
folly/Format.cpp
folly/Makefile.am
folly/fibers/FiberManager.cpp
folly/portability/Constexpr.h
folly/portability/test/ConstexprTest.cpp
folly/small_vector.h
folly/test/ConstexprMathTest.cpp [new file with mode: 0644]
folly/test/Makefile.am