2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief INet6Address non-inline template implementation */
17 #include "INet6Address.ih"
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 template <class InputIterator>
28 prefix_ senf::INet6Address senf::INet6Address::from_data(InputIterator i)
30 INet6Address addr (senf::noinit);
31 iterator j (addr.begin());
32 iterator const j_end (addr.end());
33 for (;j!=j_end;++j,++i)
38 //-/////////////////////////////////////////////////////////////////////////////////////////////////
39 // namespace senf::detail members
41 template <class ForwardIterator, class Function>
42 prefix_ void senf::detail::apply_mask(unsigned bits, ForwardIterator b, ForwardIterator e,
45 for (; bits>8 && b != e; bits -= 8, ++b)
46 fn(*b, boost::lambda::make_const(0xFFu));
47 if (bits > 0 && b != e)
48 fn( *(b++), boost::lambda::make_const(~ low_bits_mask(8-bits)));
50 fn(*b, boost::lambda::make_const(0u));
53 template <class ForwardIterator1, class ForwardIterator2, class Function>
54 prefix_ ForwardIterator1 senf::detail::find_if_mask(unsigned bits, ForwardIterator1 b1,
55 ForwardIterator1 e1, ForwardIterator2 b2,
58 for (; bits>8 && b1 != e1; bits -= 8, ++b1, ++b2)
59 if (fn(*b1, *b2, boost::lambda::make_const(0xFFu)))
61 if (bits > 0 && b1 != e1)
62 if (fn(*b1, *b2, boost::lambda::make_const(~ low_bits_mask(8-bits))))
64 for (++b1, ++b2; b1 != e1; ++b1, ++b2)
65 if (fn(*b1, *b2, boost::lambda::make_const(0u)))
70 //-/////////////////////////////////////////////////////////////////////////////////////////////////
78 // c-file-style: "senf"
79 // indent-tabs-mode: nil
80 // ispell-local-dictionary: "american"
81 // compile-command: "scons -u test"