mirror of https://github.com/ARMmbed/mbed-os.git
Added missing masks and fixed bit ordering in is_random_xx_address() functions
parent
d8b63fc03d
commit
6c6af1b0d5
|
|
@ -229,8 +229,8 @@ static bool is_prand_24_bits_valid(const BLEProtocol::AddressBytes_t address)
|
||||||
*/
|
*/
|
||||||
static bool is_random_static_address(const BLEProtocol::AddressBytes_t address)
|
static bool is_random_static_address(const BLEProtocol::AddressBytes_t address)
|
||||||
{
|
{
|
||||||
// top two msb bits shall be equal to 1.
|
// top two msb bits shall be equal to 0b11.
|
||||||
if ((address[5] >> 6) != 0x03) {
|
if (((address[5] >> 6) & 0xC0) != 0xC0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,8 +243,8 @@ static bool is_random_static_address(const BLEProtocol::AddressBytes_t address)
|
||||||
static bool is_random_private_non_resolvable_address(
|
static bool is_random_private_non_resolvable_address(
|
||||||
const BLEProtocol::AddressBytes_t address
|
const BLEProtocol::AddressBytes_t address
|
||||||
) {
|
) {
|
||||||
// top two msb bits shall be equal to 0.
|
// top two msb bits shall be equal to 0b00.
|
||||||
if ((address[5] >> 6) != 0x00) {
|
if (((address[5] >> 6) & 0xC0) != 0x00) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -257,8 +257,8 @@ static bool is_random_private_non_resolvable_address(
|
||||||
static bool is_random_private_resolvable_address(
|
static bool is_random_private_resolvable_address(
|
||||||
const BLEProtocol::AddressBytes_t address
|
const BLEProtocol::AddressBytes_t address
|
||||||
) {
|
) {
|
||||||
// top two msb bits shall be equal to 01.
|
// top two msb bits shall be equal to 0b01.
|
||||||
if ((address[5] >> 6) != 0x01) {
|
if (((address[5] >> 6) & 0xC0) != 0x40) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue