Advice required for code using multiplication & division operations #859
tnm23
started this conversation in
Support / Q & A
Replies: 1 comment 2 replies
-
You can use all such operations, the compiler will take care of the necessary to accomplish it, it will not fail to compile absent other errors. You are unlikely to be able to write better more optimised code than the compiler will. Avoid floating point. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Given the complete lack of hardware support for multiplication or division in most (all?) attinys, how does the Arduino compiler handle code that contains mathematical operators like *, /, % when using ATTinyCore? Is it safe to use them, or will they produce awful, gigantic, slow code, or just fail to compile at all? is it generally recommended to avoid using these and write one's own explicit arithmetic algorithms (using the Russian Peasant algorithm or something of that nature) instead of using the inbuilt operators? IIRC it's not permitted to overload the pre-defined mathematical infix operators for inbuilt operands like integers in standard CPP, but is there perhaps an unofficial, dirty way to do it so that libraries written using these operators will compile correctly using customised definitions for them?
Beta Was this translation helpful? Give feedback.
All reactions