mirror of
https://github.com/thelsing/knx.git
synced 2025-08-03 13:48:15 +02:00
corrected byte order during access to sorted array
This commit is contained in:
parent
f9f9914130
commit
c56182a80f
@ -38,7 +38,6 @@ uint16_t AddressTableObject::getTsap(uint16_t addr)
|
|||||||
{
|
{
|
||||||
uint16_t size = entryCount();
|
uint16_t size = entryCount();
|
||||||
#ifdef USE_BINSEARCH
|
#ifdef USE_BINSEARCH
|
||||||
addr = htons(addr);
|
|
||||||
|
|
||||||
uint16_t low,high,i;
|
uint16_t low,high,i;
|
||||||
low = 1;
|
low = 1;
|
||||||
@ -47,9 +46,10 @@ uint16_t AddressTableObject::getTsap(uint16_t addr)
|
|||||||
while(low <= high)
|
while(low <= high)
|
||||||
{
|
{
|
||||||
i = (low+high)/2;
|
i = (low+high)/2;
|
||||||
if (_groupAddresses[i] == addr)
|
uint16_t ga = ntohs(_groupAddresses[i]);
|
||||||
|
if (ga == addr)
|
||||||
return i;
|
return i;
|
||||||
if(addr < _groupAddresses[i])
|
if(addr < ga)
|
||||||
high = i - 1;
|
high = i - 1;
|
||||||
else
|
else
|
||||||
low = i + 1 ;
|
low = i + 1 ;
|
||||||
|
Loading…
Reference in New Issue
Block a user