X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FProtocols%2FINet%2FINet6Address.ct;h=adcbacabe946ffdc506ad116f29750b22935b696;hb=a1fdb7bb122f0b05be809a922d4b7ef5e125fa67;hp=fa6374522b9d4558b92444d68a061b62c5661a0c;hpb=f47178d89402cc90b67143ceb6c0fd5b3fa2a976;p=senf.git diff --git a/Socket/Protocols/INet/INet6Address.ct b/Socket/Protocols/INet/INet6Address.ct index fa63745..adcbaca 100644 --- a/Socket/Protocols/INet/INet6Address.ct +++ b/Socket/Protocols/INet/INet6Address.ct @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ template prefix_ senf::INet6Address senf::INet6Address::from_data(InputIterator i) { - INet6Address addr (INet6Address::noinit); + INet6Address addr (senf::noinit); iterator j (addr.begin()); iterator const j_end (addr.end()); for (;j!=j_end;++j,++i) @@ -51,17 +51,12 @@ template prefix_ void senf::detail::apply_mask(unsigned bits, ForwardIterator b, ForwardIterator e, Function fn) { - for(; b != e; ++b) { - boost::uint8_t mask (0); - if (bits > 8) { - mask = 0xFFu; - bits -= 8; - } else if (bits > 0) { - mask = ~ low_bits_mask(8-bits); - bits = 0; - } - fn(*b,mask); - } + for(; bits>8 && b != e; bits -= 8, ++b) + fn(*b, boost::lambda::make_const(0xFFu)); + if (bits > 0 && b != e) + fn( *(b++), boost::lambda::make_const(~ low_bits_mask(8-bits))); + for(; b != e; ++b) + fn(*b, boost::lambda::make_const(0u)); } template @@ -69,18 +64,15 @@ prefix_ ForwardIterator1 senf::detail::find_if_mask(unsigned bits, ForwardIterat ForwardIterator1 e1, ForwardIterator2 b2, Function fn) { - for(; b1 != e1; ++b1, ++b2) { - boost::uint8_t mask (0); - if (bits > 8) { - mask = 0xFFu; - bits -= 8; - } else if (bits > 0) { - mask = ~ low_bits_mask(8-bits); - bits = 0; - } - if (fn(*b1,*b2,mask)) + for(; bits>8 && b1 != e1; bits -= 8, ++b1, ++b2) + if (fn(*b1, *b2, boost::lambda::make_const(0xFFu))) + return b1; + if (bits > 0 && b1 != e1) + if (fn( *(b1++), *(b2++), boost::lambda::make_const(~ low_bits_mask(8-bits)))) + return b1; + for(; b1 != e1; ++b1, ++b2) + if (fn(*b1, *b2, boost::lambda::make_const(0u))) return b1; - } return e1; }