[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists closed this revision. mclow.lists added a comment. Committed as revision 364862 CHANGES SINCE LAST ACTION https://reviews.llvm.org/D51262/new/ https://reviews.llvm.org/D51262 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF accepted this revision. EricWF added inline comments. This revision is now accepted and ready to land. Comment at: libcxx/include/bit:240 +else if constexpr (sizeof(_Tp) <= sizeof(unsigned long)) +return __clz(static_cast(__t)) + -

[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked 2 inline comments as done. mclow.lists added inline comments. Comment at: libcxx/include/bit:203 +template +inline _LIBCPP_INLINE_VISIBILITY constexpr +enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp> EricWF wrote: > Why the explicit

[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked 2 inline comments as done. mclow.lists added inline comments. Comment at: libcxx/include/bit:208 +const unsigned int __dig = numeric_limits<_Tp>::digits; +return (__cnt % __dig) == 0 +? __t EricWF wrote: > Why did you choose to

[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists updated this revision to Diff 207395. mclow.lists marked an inline comment as done. mclow.lists added a comment. Removed explicit `inline`s, changed ternary into `if` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D51262/new/ https://reviews.llvm.org/D51262 Files:

[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked 5 inline comments as done. mclow.lists added a comment. I missed a couple of Eric's comments. Comment at: libcxx/include/bit:211 +? __t +: (__t << (__cnt % __dig)) | (__t >> (__dig - (__cnt % __dig))); +} xbolva00 wrote: >

[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists updated this revision to Diff 207394. mclow.lists marked an inline comment as done. mclow.lists added a comment. Updated patch based on Eric's comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D51262/new/ https://reviews.llvm.org/D51262 Files: libcxx/include/bit

[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments. Comment at: libcxx/include/bit:240 +else if constexpr (sizeof(_Tp) <= sizeof(unsigned long)) +return __clz(static_cast(__t)) + - (numeric_limits::digits - numeric_limits<_Tp>::digits); mclow.lists

[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked 7 inline comments as done. mclow.lists added inline comments. Comment at: libcxx/include/bit:236 + +if constexpr (sizeof(_Tp) <= sizeof(unsigned int)) +return __clz(static_cast(__t)) EricWF wrote: > Weird indentation.

[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added inline comments. Comment at: libcxx/include/bit:211 +? __t +: (__t << (__cnt % __dig)) | (__t >> (__dig - (__cnt % __dig))); +} mclow.lists wrote: > Quuxplusone wrote: > > No sane compiler would actually generate three `mod`

[PATCH] D51262: Implement P0553 and P0556

2019-07-01 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment. I would like to see a version of this after the inline comments are addressed. Comment at: libcxx/include/bit:193 + is_unsigned_v<_Tp> && +!is_same_v, bool> && +!is_same_v, char> && `_IsNotSame` is faster and

[PATCH] D51262: Implement P0553 and P0556

2019-06-25 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists updated this revision to Diff 206571. mclow.lists marked 4 inline comments as done. mclow.lists added a comment. Address a couple of review comments. Added a few more `uint128_t` rotation tests CHANGES SINCE LAST ACTION https://reviews.llvm.org/D51262/new/

[PATCH] D51262: Implement P0553 and P0556

2019-06-25 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment. In D51262#1557154 , @jwakely wrote: > In D51262#1213514 , @mclow.lists > wrote: > > > I should also mention that as a conforming extension, I have implemented > > the non-numeric bit

[PATCH] D51262: Implement P0553 and P0556

2019-06-25 Thread Jonathan Wakely via Phabricator via cfe-commits
jwakely added a comment. In D51262#1213514 , @mclow.lists wrote: > I should also mention that as a conforming extension, I have implemented the > non-numeric bit operations for `std::byte` I thought there was a DR or proposal to enable that, but I

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked an inline comment as done. mclow.lists added inline comments. Comment at: libcxx/include/bit:378 + const unsigned __retVal = 1u << (__n + __extra); + return (_Tp) (__retVal >> __extra); +} mclow.lists wrote: > mclow.lists

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked an inline comment as done. mclow.lists added inline comments. Comment at: libcxx/include/bit:378 + const unsigned __retVal = 1u << (__n + __extra); + return (_Tp) (__retVal >> __extra); +} mclow.lists wrote: > Quuxplusone

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked 4 inline comments as done. mclow.lists added inline comments. Comment at: libcxx/include/bit:252 +while (true) { +__t = rotr<_Tp>(__t, __ulldigits); +if ((__iter = countl_zero(static_cast(__t))) != __ulldigits)

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments. Comment at: libcxx/include/bit:378 + const unsigned __retVal = 1u << (__n + __extra); + return (_Tp) (__retVal >> __extra); +} mclow.lists wrote: > mclow.lists wrote: > > Quuxplusone wrote: > > > Why so

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked an inline comment as done. mclow.lists added inline comments. Comment at: libcxx/include/bit:378 + const unsigned __retVal = 1u << (__n + __extra); + return (_Tp) (__retVal >> __extra); +} mclow.lists wrote: > Quuxplusone

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked 2 inline comments as done. mclow.lists added inline comments. Comment at: libcxx/include/bit:199 +!is_same_v, char32_t> + > {}; + Quuxplusone wrote: > Given how heavily the code controlled by this trait depends on >

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked an inline comment as done. mclow.lists added inline comments. Comment at: libcxx/include/bit:378 + const unsigned __retVal = 1u << (__n + __extra); + return (_Tp) (__retVal >> __extra); +} Quuxplusone wrote: > Why so

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Arthur O'Dwyer via Phabricator via cfe-commits
Quuxplusone added inline comments. Comment at: libcxx/include/bit:199 +!is_same_v, char32_t> + > {}; + Given how heavily the code controlled by this trait depends on `numeric_limits<_Tp>`, would it make sense to add something in here about how that

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment. > Also are the unsigned types that aren't integral? I believe that people are allowed to specialize `is_unsigned` for their own (bignum, say) types. However, `is_integral` is not extensible. It refers to the types in `[basic.fundamental]` > Type `bool` is a

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists marked 4 inline comments as done. mclow.lists added inline comments. Comment at: include/bit:254 + +if constexpr (sizeof(_Tp) <= sizeof(unsigned int)) + return __clz(static_cast(__t)) EricWF wrote: > Cool use of `if constexpr`. > >

[PATCH] D51262: Implement P0553 and P0556

2019-06-24 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists updated this revision to Diff 206339. mclow.lists added a comment. Update this patch to implement P1355R2 which makes out-of-bound inputs for `ceil2`UB. This was easy for integer types that are at least as big as `int`, but harder for smaller ones.

[PATCH] D51262: Implement P0553 and P0556

2019-06-14 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment. Herald added a subscriber: dexonsmith. Please use Clang format on these changes. Otherwise the implementation looks great, I've left some nits. Comment at: include/bit:190 +template +struct __bitop_unsigned_integer +: public integral_constant && +

[PATCH] D51262: Implement P0553 and P0556

2018-08-25 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists added a comment. I should also mention that as a conforming extension, I have implemented the non-numeric bit operations for `std::byte` https://reviews.llvm.org/D51262 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D51262: Implement P0553 and P0556

2018-08-25 Thread Marshall Clow via Phabricator via cfe-commits
mclow.lists created this revision. mclow.lists added reviewers: EricWF, ldionne. Herald added a subscriber: christof. LWG adopted https://wg21.link/P0553 in Rapperswil, and suggested minor changes to https://wg21.link/P0556. They kind of go together; for example, `ispow2` is easily implemented