2791: Rewrite not_inplace.

* mln/logical/not.hh, * mln/logical/not.spe.hh: Write a dedicated version of not_inplace. --- milena/ChangeLog | 8 ++++++++ milena/mln/logical/not.hh | 23 ++++++++++++++++++----- milena/mln/logical/not.spe.hh | 35 +++++++++++++++++++++++++++++------ 3 files changed, 55 insertions(+), 11 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 80c3f74..6dc42f8 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,4 +1,12 @@ 2008-11-03 Guillaume Lazzara <z@lrde.epita.fr> + + Rewrite not_inplace. + + * mln/logical/not.hh, + * mln/logical/not.spe.hh: Write a dedicated version of not_inplace. + + +2008-11-03 Guillaume Lazzara <z@lrde.epita.fr> Add trace::warning. diff --git a/milena/mln/logical/not.hh b/milena/mln/logical/not.hh index 69e5a29..fbbca34 100644 --- a/milena/mln/logical/not.hh +++ b/milena/mln/logical/not.hh @@ -82,15 +82,28 @@ namespace mln { template <typename I, typename O> inline - void not__(const I& input, O& output) + void not_(const I& input, O& output) { - trace::entering("logical::impl::generic::not__"); + trace::entering("logical::impl::generic::not_"); mln_piter(I) p(input.domain()); for_all(p) output(p) = ! input(p); - trace::exiting("logical::impl::generic::not__"); + trace::exiting("logical::impl::generic::not_"); + } + + template <typename I> + inline + void not_inplace(I& inout) + { + trace::entering("logical::impl::generic::not_"); + + mln_piter(I) p(inout.domain()); + for_all(p) + inout(p) = ! inout(p); + + trace::exiting("logical::impl::generic::not_"); } } @@ -109,7 +122,7 @@ namespace mln mln_concrete(I) output; initialize(output, input); - impl::not__(mln_trait_image_speed(I)(), exact(input), output); + impl::not_(mln_trait_image_speed(I)(), exact(input), output); trace::exiting("logical::not"); return output; @@ -122,7 +135,7 @@ namespace mln trace::entering("logical::not_inplace"); mln_precondition(exact(input).has_data()); - impl::not__(mln_trait_image_speed(I)(), exact(input), exact(input)); + impl::not_inplace(mln_trait_image_speed(I)(), exact(input)); trace::exiting("logical::not_inplace"); } diff --git a/milena/mln/logical/not.spe.hh b/milena/mln/logical/not.spe.hh index 8e5f7c6..927f4f5 100644 --- a/milena/mln/logical/not.spe.hh +++ b/milena/mln/logical/not.spe.hh @@ -55,28 +55,51 @@ namespace mln namespace generic { template <typename I, typename O> - void not__(const I& input, O& output); + void not_(const I& input, O& output); + + template <typename I> + void not_inplace(I& inout); } template <typename I, typename O> inline - void not__(trait::image::speed::any, const I& input, O& output) + void not_(trait::image::speed::any, const I& input, O& output) + { + generic::not_(input, output); + } + + template <typename I> + inline + void not_inplace(trait::image::speed::any, I& inout) { - generic::not__(input, output); + generic::not_inplace(inout); } template <typename I, typename O> inline - void not__(trait::image::speed::fastest, const I& input, O& output) + void not_(trait::image::speed::fastest, const I& input, O& output) { - trace::entering("logical::impl::not__"); + trace::entering("logical::impl::not_"); mln_pixter(const I) ip(input); mln_pixter(O) op(output); for_all_2(ip, op) op.val() = ! ip.val(); - trace::exiting("logical::impl::not__"); + trace::exiting("logical::impl::not_"); + } + + template <typename I> + inline + void not_inplace(trait::image::speed::fastest, I& inout) + { + trace::entering("logical::impl::not_inplace"); + + mln_pixter(I) p(inout); + for_all(p) + p.val() = ! p.val(); + + trace::exiting("logical::impl::not_inplace"); } } // end of namespace mln::logical::impl -- 1.5.6.5
participants (1)
-
Guillaume Lazzara