Hello Folks,
benwilliam, the guy who contributed lcdDrawEllipse() also contributed two files, fastMath.h and fastMath.c which can be found in the glcd directory. In there he has some simpler functions to get the sine value etc. That is because he used this on some small 8-bit AVRs.
However, inside fastMath.c, there is float sinetable[91]. This values are stored in RAM because the tiny AVRs would have to long to use sin().
Does it make sense to keep these 364 bytes in RAM or isn't sin() that expensive on ARMs?
~ Tectu
fastMath
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: fastMath
I would not write architecture-specific code, make it optimal thinking in general "C", architecture-optimized code paths can be added later.
Giovanni
Giovanni
Re: fastMath
I fully agree with that. I asked some guys which know much about this stuff. They said that sin() is fine when using things like newlib etc.
This wouldn't result in any architectur specific code as well, eh?
~ Tectu
This wouldn't result in any architectur specific code as well, eh?
~ Tectu
Re: fastMath
The fastMath code is used only for drawing rotated rectangles and other things, not for the ellipse drawing routines we are doing currently, this means, that the file is unused as of now.
Re: fastMath
That's correct. I just kept it because benwilliam told me he will keep working on the rotated rectangles etc. The question was meant in general, not depending on lcdDrawEllipse()
~ Tectu
~ Tectu
Re: fastMath
This is code that I will probably be using when I create my audio mixer and tone generator driver. Being able to generate sin's really fast is going to be important and so I am going to be doing testing to compare with the native library routines (which I suspect will be very slow).
Please keep the code around - it will find a use, and my possible use of sin's is likely such a one.
Please keep the code around - it will find a use, and my possible use of sin's is likely such a one.
Re: fastMath
I have code is still arround, since benwilliam agreed to the license change too 
~ Tectu
~ Tectu