added CCECTypeUtils::PhysicalAddressIsIncluded()
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 18 Oct 2012 11:51:42 +0000 (13:51 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 18 Oct 2012 15:31:55 +0000 (17:31 +0200)
src/lib/CECTypeUtils.h

index 21a651d59fe259fbcabcbb5683aacc3a761143c9..239fc66086ec7eb13caea24191fe9977a1f06cd1 100644 (file)
@@ -819,5 +819,16 @@ namespace CEC
         return "unknown";
       }
     }
+
+    static bool PhysicalAddressIsIncluded(uint16_t iParent, uint16_t iChild)
+    {
+      for (int iPtr = 3; iPtr >= 0; iPtr--)
+      {
+        if (((iParent >> 4*iPtr) & 0xF) > 0 &&
+            ((iParent >> 4*iPtr) & 0xF) != ((iChild >> 4*iPtr) & 0xF))
+          return false;
+      }
+      return true;
+    }
   };
 }