lib/C/iec_std_functions.h
changeset 1068 222879991f44
parent 1067 ce81fa6d9024
child 1069 0b275a2c7c2b
equal deleted inserted replaced
1067:ce81fa6d9024 1068:222879991f44
   491 
   491 
   492 /*****************************************************/
   492 /*****************************************************/
   493 /***   Table 24 - Standard arithmetic functions    ***/
   493 /***   Table 24 - Standard arithmetic functions    ***/
   494 /*****************************************************/
   494 /*****************************************************/
   495 
   495 
       
   496 /* NOTE: unlike all other standard functions, the arithmetic based (extensible) functions
       
   497  *       (ADD, MUL, AND, OR, XOR) have several implementations:
       
   498  *        - 8 optimized versions for when the functon is called with 1 to 8 INput parameters
       
   499  *        - an extra non-optimized version for every other case. 
       
   500  *       
       
   501  *       This means that instead of the functions usually named 
       
   502  *           ADD_TTTT() 
       
   503  *           ADD__TTTT__TTTT()        (where TTTT is a type, e.g. INT)
       
   504  *       we have instead
       
   505  *           ADD_TTTT1(),  ADD_TTTT2(), ... ,ADD_TTTT8()
       
   506  *           ADD_TTTTX()              
       
   507  *           ADD_TTTT_VAR()           
       
   508  *           ADD__TTTT__TTTT1(), ..., ADD__TTTT__TTTT8()       
       
   509  *           ADD__TTTT__TTTT_VAR()    
       
   510  *       
       
   511  *       The standard names
       
   512  *           ADD_TTTT() 
       
   513  *           ADD__TTTT__TTTT()
       
   514  *       are instead later (in this .h file) declared as macros, which will choose
       
   515  *       at compilation time the correct version/implementation to call
       
   516  *       based on the number of input parameters in that specific call.
       
   517  */
   496 #define __arith_expand(fname, TYPENAME, OP)				\
   518 #define __arith_expand(fname, TYPENAME, OP)				\
   497 									\
   519 									\
   498 	static inline TYPENAME fname##1(EN_ENO_PARAMS			\
   520 	static inline TYPENAME fname##1(EN_ENO_PARAMS			\
   499 					TYPENAME op1) {			\
   521 					TYPENAME op1) {			\
   500 		TEST_EN(TYPENAME);					\
   522 		TEST_EN(TYPENAME);					\