BMI1 support in EliasFanoCoding
[folly.git] / folly / IPAddressV4.cpp
index ae403eb4285f664d4483cf812a05b42d79e7d21c..d66993c4bde13d359e205881ac3f71e08a44e195 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "IPAddressV4.h"
+#include <folly/IPAddressV4.h>
 
 #include <ostream>
 #include <string>
@@ -28,6 +28,7 @@ using std::string;
 
 namespace folly {
 
+
 // free functions
 size_t hash_value(const IPAddressV4& addr) {
   return addr.hash();
@@ -143,6 +144,11 @@ bool IPAddressV4::inSubnetWithMask(const IPAddressV4& subnet,
   return (mask == subMask);
 }
 
+bool IPAddressV4::isLoopback() const {
+  static IPAddressV4 loopback_addr("127.0.0.0");
+  return inSubnetWithMask(loopback_addr, fetchMask(8));
+}
+
 // public
 bool IPAddressV4::isNonroutable() const {
   auto ip = toLongHBO();