Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all getters constant? #39

Open
JohnDepaszthory opened this issue Jan 13, 2023 · 0 comments
Open

Make all getters constant? #39

JohnDepaszthory opened this issue Jan 13, 2023 · 0 comments

Comments

@JohnDepaszthory
Copy link
Contributor

JohnDepaszthory commented Jan 13, 2023

Since the getters for CANScience were made to use getters constant, I think this should be consistent across the code base. There are a lot of getters scattered throughout that are not const.
Just one example:

int32_t DecodeTelemetryDataSigned(CANPacket *packet)
{
    return DecodeBytesToIntMSBFirst(packet->data, 4, 8);
}

uint32_t DecodeTelemetryDataUnsigned(CANPacket *packet)
{
    return (uint32_t) DecodeTelemetryDataSigned(packet);
}

uint8_t DecodeTelemetryType(CANPacket *packet)
{
    return packet->data[3];
}

In CANCommon.c. Not really a big deal but the compiler may be able to optimize better if they're declared const and every byte and cycle counts on an embedded platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant