-
Notifications
You must be signed in to change notification settings - Fork 110
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
Basic math and bitwise operators #154
base: master
Are you sure you want to change the base?
Conversation
…ces for each variable type.
…templates for all data types.
Cool reuse! Does anyone object to the use of these kinds of macro functions? What kind of efficiency do you get? Loops are quite simple and shallow? What does the generated code look like? |
{ \ | ||
*c = ~*(a); \ | ||
for (;--n;) \ | ||
*c = ~*(a + n); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*(c + n) = ~*(a + n); \
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mateunho Thanks, fixed.
@aolofsson Yes, loops are very shallow ( will look into the possibility of using a duff's device to do some unrolling, or if -funroll-all-loops can be used without pigging out on size). Also I noticed it can be counterproductive to have a decreasing index.
What I think we should do now is to define a number of platforms we want to target and the compiler flags we want to use ( O2 or O3, and more importantly on x86 the SSE flags. Or should we split x86 in 2 ).
What is the preferred method of implementing platform specific code? #ifdef tree?
Signed-off-by: Thomas Böhm <[email protected]>
Implemented the basic mathematical operator ( addition, subtraction, multiplication, division ) and logical bit operators ( and, or, xor, not ) as templates and instantiated them for all data types supported by Epiphany.