BIND 10 trac998, updated. 5a19ee14367d9bb796c8e43c034ee9f327052c86 [trac998] move createMask to .cc; it cannot be in .h now that it's become a non templated function.

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jun 23 18:13:56 UTC 2011


The branch, trac998 has been updated
       via  5a19ee14367d9bb796c8e43c034ee9f327052c86 (commit)
      from  f92d30bb55decf9ed4d7cdf10231dfe2913ca11a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5a19ee14367d9bb796c8e43c034ee9f327052c86
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Thu Jun 23 11:13:15 2011 -0700

    [trac998] move createMask to .cc; it cannot be in .h now that it's become
    a non templated function.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/acl/ip_check.cc |   35 +++++++++++++++++++++++++++++++++++
 src/lib/acl/ip_check.h  |   34 +---------------------------------
 2 files changed, 36 insertions(+), 33 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/acl/ip_check.cc b/src/lib/acl/ip_check.cc
index 57291a6..08c8431 100644
--- a/src/lib/acl/ip_check.cc
+++ b/src/lib/acl/ip_check.cc
@@ -24,6 +24,41 @@ namespace isc {
 namespace acl {
 namespace internal {
 
+uint8_t
+createMask(size_t prefixlen) {
+
+    if (prefixlen == 0) {
+        return (0);
+
+    } else if (prefixlen <= 8) {
+
+        // In the following discussion:
+        //
+        // w is the width of the data type in bits.
+        // m is the value of prefixlen, the number of most signifcant bits we
+        // want to set.
+        // ** is exponentiation (i.e. 2**n is 2 raised to the power of n).
+        //
+        // We note that the value of 2**m - 1 gives a value with the least
+        // significant m bits set.  For a data type of width w, this means that
+        // the most signficant (w-m) bits are clear.
+        //
+        // Hence the value 2**(w-m) - 1 gives a result with the least signficant
+        // w-m bits set and the most significant m bits clear.  The 1's
+        // complement of this value gives is the result we want.
+        //
+        // Final note: at this point in the logic, m is non-zero, so w-m < w.
+        // This means 1<<(w-m) will fit into a variable of width w bits.  In
+        // other words, in the expression below, no term will cause an integer
+        // overflow.
+        return (~((1 << (8 - prefixlen)) - 1));
+    }
+
+    // Mask size is too large. (Note that prefixlen is unsigned, so can't be
+    // negative.)
+    isc_throw(isc::OutOfRange, "prefixlen argument must be between 0 and 8");
+}
+
 pair<string, int>
 splitIPAddress(const string& ipprefix) {
 
diff --git a/src/lib/acl/ip_check.h b/src/lib/acl/ip_check.h
index fa00f0f..beaeed4 100644
--- a/src/lib/acl/ip_check.h
+++ b/src/lib/acl/ip_check.h
@@ -53,39 +53,7 @@ namespace internal {
 ///
 /// \exception OutOfRange prefixlen is too large for the data type.
 
-uint8_t createMask(size_t prefixlen) {
-
-    if (prefixlen == 0) {
-        return (0);
-
-    } else if (prefixlen <= 8) {
-
-        // In the following discussion:
-        //
-        // w is the width of the data type in bits.
-        // m is the value of prefixlen, the number of most signifcant bits we
-        // want to set.
-        // ** is exponentiation (i.e. 2**n is 2 raised to the power of n).
-        //
-        // We note that the value of 2**m - 1 gives a value with the least
-        // significant m bits set.  For a data type of width w, this means that
-        // the most signficant (w-m) bits are clear.
-        //
-        // Hence the value 2**(w-m) - 1 gives a result with the least signficant
-        // w-m bits set and the most significant m bits clear.  The 1's
-        // complement of this value gives is the result we want.
-        //
-        // Final note: at this point in the logic, m is non-zero, so w-m < w.
-        // This means 1<<(w-m) will fit into a variable of width w bits.  In
-        // other words, in the expression below, no term will cause an integer
-        // overflow.
-        return (~((1 << (8 - prefixlen)) - 1));
-    }
-
-    // Mask size is too large. (Note that prefixlen is unsigned, so can't be
-    // negative.)
-    isc_throw(isc::OutOfRange, "prefixlen argument must be between 0 and 8");
-}
+uint8_t createMask(size_t prefixlen);
 
 /// \brief Split IP Address Prefix
 ///




More information about the bind10-changes mailing list