mirror of
https://github.com/espressif/openthread.git
synced 2026-08-15 07:07:46 +00:00
[instance] fix index computation in multi-instances context (#11099)
In multi instances context, the GetIdx function did not return the correct instance index.
This commit is contained in:
@@ -351,9 +351,7 @@ Instance &Instance::Get(uint8_t aIdx)
|
||||
|
||||
uint8_t Instance::GetIdx(Instance *aInstance)
|
||||
{
|
||||
return static_cast<uint8_t>(
|
||||
(reinterpret_cast<uint8_t *>(aInstance) - reinterpret_cast<uint8_t *>(gMultiInstanceRaw)) /
|
||||
INSTANCE_SIZE_ALIGNED);
|
||||
return static_cast<uint8_t>((reinterpret_cast<uint64_t *>(aInstance) - gMultiInstanceRaw) / INSTANCE_SIZE_ALIGNED);
|
||||
}
|
||||
|
||||
#endif // #if OPENTHREAD_CONFIG_MULTIPLE_STATIC_INSTANCE_ENABLE
|
||||
|
||||
Reference in New Issue
Block a user