version 1.13.2.2, 2012/09/10 12:03:56
|
version 1.13.2.3, 2012/09/17 13:44:22
|
Line 816 io_setlikeVar(ait_val_t * __restrict v, ait_type_t t,
|
Line 816 io_setlikeVar(ait_val_t * __restrict v, ait_type_t t,
|
|
|
return 0; |
return 0; |
} |
} |
|
|
|
/* |
|
* 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) |
|
{ |
|
intptr_t ret; |
|
|
|
if (!(ret = (a - b))) |
|
return ret; |
|
if ((ret = AIT_TYPE(a) - AIT_TYPE(b))) |
|
return ret; |
|
if ((ret = AIT_LEN(a) - AIT_LEN(b))) |
|
return ret; |
|
|
|
switch (AIT_TYPE(a)) { |
|
case buffer: |
|
ret = memcmp(AIT_GET_BUF(a), AIT_GET_BUF(b), AIT_LEN(a)); |
|
break; |
|
case string: |
|
ret = strncmp(AIT_GET_STR(a), AIT_GET_STR(b), AIT_LEN(a)); |
|
break; |
|
case data: |
|
ret = memcmp(AIT_GET_DATA(a), AIT_GET_DATA(b), AIT_LEN(a)); |
|
break; |
|
case ptr: |
|
ret = AIT_ADDR(a) - AIT_ADDR(b); |
|
break; |
|
default: |
|
ret = AIT_RAW(a) - AIT_RAW(b); |
|
break; |
|
} |
|
|
|
return (int) ret; |
|
} |