1 #include "csf.h"
2 #include "csfimpl.h"
3 
4 /* test if a value is missing value
5  * returns 0 if not, nonzero if it is a missing value
6  */
IsMV(const MAP * map,const void * cellValue)7 int  IsMV(
8 	const MAP *map, /* map handle */
9 	const void *cellValue) /* value to be tested */
10 {
11 	return(IsMVcellRepr(map->appCR, cellValue));
12 }
13 
14 /* test if a value is missing value
15  * returns 0 if not, nonzero if it is a missing value
16  */
IsMVcellRepr(CSF_CR cellRepr,const void * cellValue)17 int  IsMVcellRepr(
18 	CSF_CR cellRepr,        /* cell representation of argument cellValue.
19 	                        * That is one of the constants prefixed by CR_.
20 	                        */
21 	const void *cellValue) /* value to be tested */
22 {
23 
24 	if (IS_SIGNED(cellRepr))
25 	 	switch ( (cellRepr & CSF_SIZE_MV_MASK ) >> CSF_POS_SIZE_MV_MASK)
26 		{
27 		case 0:	return(*((const INT1 *)cellValue) == MV_INT1);
28 		case 1:	return(*((const INT2 *)cellValue) == MV_INT2);
29 		default:return(*((const INT4 *)cellValue) == MV_INT4);
30 		}
31 	else
32 		if (IS_REAL(cellRepr))
33 		{
34 			if (cellRepr == CR_REAL4)
35 				return(IS_MV_REAL4(cellValue));
36 			else
37 				return(IS_MV_REAL8(cellValue));
38 		}
39 		else
40 		{
41 			switch ( (cellRepr & CSF_SIZE_MV_MASK ) >> CSF_POS_SIZE_MV_MASK)
42 			{
43 			case 0:    return(*((const UINT1 *)cellValue) == MV_UINT1);
44 			case 1:	   return(*((const UINT2 *)cellValue) == MV_UINT2);
45 			default:   return(*((const UINT4 *)cellValue) == MV_UINT4);
46 			}
47 		}
48 }
49