From: Lars Op den Kamp Date: Thu, 18 Oct 2012 11:51:42 +0000 (+0200) Subject: added CCECTypeUtils::PhysicalAddressIsIncluded() X-Git-Tag: upstream/2.2.0~1^2~13^2~18 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6acb9c0bfd389f1ad4d052582b27a1a395322135;p=deb_libcec.git added CCECTypeUtils::PhysicalAddressIsIncluded() --- diff --git a/src/lib/CECTypeUtils.h b/src/lib/CECTypeUtils.h index 21a651d..239fc66 100644 --- a/src/lib/CECTypeUtils.h +++ b/src/lib/CECTypeUtils.h @@ -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; + } }; }