src/core/thread/mle_tlvs.hpp
void SetRouteCost(uint8_t aRouterIndex, uint8_t aRouteCost)
    {
        if (aRouterIndex & 1)
        {
            mRouteData[aRouterIndex + aRouterIndex / 2 + 1] = aRouteCost;
        }
        else
        {
            mRouteData[aRouterIndex + aRouterIndex / 2] =
                (mRouteData[aRouterIndex + aRouterIndex / 2] & ~kRouteCostMask) |
                ((aRouteCost >> kOddEntryOffset) & kRouteCostMask);
            mRouteData[aRouterIndex + aRouterIndex / 2 + 1] = static_cast<uint8_t>(
                (mRouteData[aRouterIndex + aRouterIndex / 2 + 1] & ~(kRouteCostMask << kOddEntryOffset)) |
                ((aRouteCost & kRouteCostMask) << kOddEntryOffset));
        }
    }
/**
     * This method sets the Route Cost value for a given Router index.
     *
     * @param[in]  aRouterIndex  The Router index.
     * @param[in]  aRouteCost    The Route Cost value.
     *
     */
This method sets the Route Cost value for a given Router index.
@param[in]  aRouterIndex  The Router index.
@param[in]  aRouteCost    The Route Cost value.
This method sets the Route Cost value for a given Router index . @param [ in ] aRouterIndex The Router index . @param [ in ] aRouteCost The Route Cost value .
void SetRouteCost(uint8_t aRouterIndex, uint8_t aRouteCost)
    {
        if (aRouterIndex & 1)
        {
            mRouteData[aRouterIndex + aRouterIndex / 2 + 1] = aRouteCost;
        }
        else
        {
            mRouteData[aRouterIndex + aRouterIndex / 2] =
                (mRouteData[aRouterIndex + aRouterIndex / 2] & ~kRouteCostMask) |
                ((aRouteCost >> kOddEntryOffset) & kRouteCostMask);
            mRouteData[aRouterIndex + aRouterIndex / 2 + 1] = static_cast<uint8_t>(
                (mRouteData[aRouterIndex + aRouterIndex / 2 + 1] & ~(kRouteCostMask << kOddEntryOffset)) |
                ((aRouteCost & kRouteCostMask) << kOddEntryOffset));
        }
    }
void SetRouteCost ( uint8_t aRouterIndex , uint8_t aRouteCost ) { if ( aRouterIndex & 1 ) { mRouteData [ aRouterIndex + aRouterIndex / 2 + 1 ] = aRouteCost ; } else { mRouteData [ aRouterIndex + aRouterIndex / 2 ] = ( mRouteData [ aRouterIndex + aRouterIndex / 2 ] & ~ kRouteCostMask ) | ( ( aRouteCost >> kOddEntryOffset ) & kRouteCostMask ) ; mRouteData [ aRouterIndex + aRouterIndex / 2 + 1 ] = static_cast < uint8_t > ( ( mRouteData [ aRouterIndex + aRouterIndex / 2 + 1 ] & ~ ( kRouteCostMask << kOddEntryOffset ) ) | ( ( aRouteCost & kRouteCostMask ) << kOddEntryOffset ) ) ; } }
This method sets the Route Cost value for a given Router index.
This method sets the Route Cost value for a given Router index .