From 8fe3310ff393f67753e14c4744266a33f2d727db Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 30 Sep 2022 10:44:59 +1000 Subject: [PATCH] AP_HAL: added id_signed for CANFrame makes for more efficient lua processing --- libraries/AP_HAL/CANIface.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/AP_HAL/CANIface.h b/libraries/AP_HAL/CANIface.h index 5319708a91..30a5564e3e 100644 --- a/libraries/AP_HAL/CANIface.h +++ b/libraries/AP_HAL/CANIface.h @@ -67,6 +67,11 @@ struct AP_HAL::CANFrame { return (id == rhs.id) && (dlc == rhs.dlc) && (memcmp(data, rhs.data, dlc) == 0); } + // signed version of id, for use by scriping where uint32_t is expensive + int32_t id_signed(void) const { + return isExtended()? int32_t(id & MaskExtID) : int32_t(id & MaskStdID); + } + bool isExtended() const { return id & FlagEFF;