mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-21 11:07:34 +08:00
34 lines
537 B
C++
34 lines
537 B
C++
/*
|
|
* Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
|
|
*/
|
|
|
|
#include <cassert>
|
|
#include <cstdio>
|
|
#include <sstream>
|
|
#include <uavcan/transport/frame.hpp>
|
|
#include <uavcan/transport/can_io.hpp>
|
|
|
|
namespace uavcan
|
|
{
|
|
/**
|
|
* NodeID
|
|
*/
|
|
const NodeID NodeID::Broadcast(ValueBroadcast);
|
|
|
|
/**
|
|
* TransferID
|
|
*/
|
|
int TransferID::computeForwardDistance(TransferID rhs) const
|
|
{
|
|
int d = int(rhs.get()) - int(get());
|
|
if (d < 0)
|
|
{
|
|
d += 1 << BitLen;
|
|
}
|
|
|
|
assert(((get() + d) & Max) == rhs.get());
|
|
return d;
|
|
}
|
|
|
|
}
|