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

Fix some compiler warnings #71

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

moshidev
Copy link

@moshidev moshidev commented Dec 2, 2022

After the changes the code compiles without warnings (got those in gcc 10.3 arm-none-eabi @ e2_studio from Renesas).

scale /= 10;
}
u = value * scale;
u = (int)(value * scale);
Copy link

@AJIOB AJIOB Feb 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
u = (int)(value * scale);
u = (uint_least32_t)(value * scale);

Also, force use long for h, i, s variables, as C99 done: https://en.cppreference.com/w/c/string/byte/strtol

And, of course, u should be uint_least32_t

Some embedded platforms like MSP430 has 16-bit ints

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

Successfully merging this pull request may close these issues.

2 participants