--- libaitio/inc/aitio.h 2012/09/10 12:03:55 1.25.2.3 +++ libaitio/inc/aitio.h 2012/09/19 15:19:53 1.26 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitio.h,v 1.25.2.3 2012/09/10 12:03:55 misho Exp $ +* $Id: aitio.h,v 1.26 2012/09/19 15:19:53 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -401,7 +401,7 @@ typedef union { #define IO_SOCKADDR_INIT { .ss = { 0 } } -#define io_align(x, a) (((x) + (a)) & ~(a)) +#define io_align(x, a) (((x) + ((a) - 1)) & ~((a) - 1)) // io_GetErrno() Get error code of last operation @@ -570,6 +570,14 @@ inline int io_setlikeVar(ait_val_t * __restrict v, ait * return: -1 error or >0 copied bytes to variable */ int io_sprintfVar(ait_val_t * __restrict v, const char *fmt, ...); +/* + * io_cmpVar() - Compare two variables + * + * @a = 1st variable + * @b = 2nd variable + * return: 0 is equal or !=0 is different + */ +inline int io_cmpVar(ait_val_t * __restrict a, ait_val_t * __restrict b); /* * io_hashVar() - Generate hash key for variable from string or value *