This commit is contained in:
deeaitch committed 2026-10-13 08:17:49 -04:00
1 parent 7022c84941
commit c3d3bd51fb
72 files changed
+3703 -2484

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: MIT
#ifndef SIGNAL_LAYOUT_H
#define SIGNAL_LAYOUT_H
#include <cstdint>
/** Linear coordinate in the signal's bit order, widened before arithmetic. */
inline std::uint64_t SignalStartCoordinate(std::uint32_t startBit, bool littleEndian) {
return littleEndian ? std::uint64_t(startBit)
: std::uint64_t(startBit / 8U) * 8U + 7U - startBit % 8U;
}
inline bool IsValidSignalLayout(std::uint32_t startBit, std::uint32_t length,
bool littleEndian, std::uint8_t dlc) {
return length >= 1U && length <= 64U &&
SignalStartCoordinate(startBit, littleEndian) + length <= std::uint64_t(dlc) * 8U;
}
#endif