CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Detecting what type of data was passed to a function

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

Detecting what type of data was passed to a function
PostPosted: Tue Dec 14, 2004 1:14 pm     Reply with quote

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







PostPosted: Tue Dec 14, 2004 1:31 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 16, 2004 4:11 pm     Reply with quote

I will try with a global struct with possible values and results.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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