I believe this is a complete implementation of std::shift_left and std::shift_right from
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0769r2.pdf
Some test cases copied-with-modification from D60027.
Differential D93819
[libc++] Implement [P0769] "Add shift to algorithm" (shift_left, shift_right) Quuxplusone on Dec 25 2020, 11:26 PM. Authored by
Details
I believe this is a complete implementation of std::shift_left and std::shift_right from Some test cases copied-with-modification from D60027.
Diff Detail
Event TimelineComment Actions Can you also grab the tests from https://reviews.llvm.org/D60027? Generally speaking, while programmatic tests (like the two nested loops you used) are great because it gives us great coverage, however I try to strike a balance and also have at least some basic and really dumb test cases written entirely manually. This avoids the risk of a bug in the tests. For some reason, that revision doesn't show up in the "Open Libc++ Reviews" query. I'll try to understand why and fix it.
Comment Actions @Quuxplusone I like this patch a lot better than mine. It seems like this implementation is essentially following the sample in the paper. I was meaning to update mine to use that approach but didn't find the time/remember. Anyway, this looks good to me, thanks! Comment Actions I'm not done with the review, but I figured I might as well give you the feedback I have right away. It generally looks good, but I think you might have forgotten about n < 0 in both algorithms.
Comment Actions
Ah ah. How confusing. Now it makes more sense. |