|
|
View previous topic :: View next topic |
Author |
Message |
future
Joined: 14 May 2004 Posts: 330
|
Detecting what type of data was passed to a function |
Posted: Tue Dec 14, 2004 1:14 pm |
|
|
Hello.
I have several of this funtions, they are working all right separate. But I am looking for a way to preserve space and not lose too much speed.
Code: | unsigned char uinterp(unsigned char x,
unsigned char x1,
unsigned char x2,
unsigned char y1,
unsigned char y2)
signed char sinterp(unsigned char x,
unsigned char x1,
unsigned char x2,
signed char y1,
signed char y2) |
One deals with unsigned chars, signed chars.. there are others for longs too.
If I have a way to know what type of data has been passed I can write an universal function.
I thought about using variables, but maybe there is another way.
Thank you. |
|
|
valemike Guest
|
|
Posted: Tue Dec 14, 2004 1:31 pm |
|
|
I'm not sure exactly what you want to do, but when you mentioned wanting to speed things up, I would say you should have a global buffer, and cast a pointer to that buffer.
That way, there are no memory copies necessary. Just pass a pointer to the function. At least that's the way ANSII C would have it. Not sure about CCS C. |
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Thu Dec 16, 2004 4:11 pm |
|
|
I will try with a global struct with possible values and results. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|