File: utilPropMask.c

package info (click to toggle)
ted 2.11-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 11,064 kB
  • ctags: 13,935
  • sloc: ansic: 120,446; makefile: 7,469; sh: 253
file content (72 lines) | stat: -rw-r--r-- 1,459 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/************************************************************************/
/*									*/
/*  Property mask operations.						*/
/*  Most is done by macros in the header file.				*/
/*									*/
/************************************************************************/

#   include	<utilPropMask.h>
#   include	<appDebugon.h>

void utilPropMaskFill(		PropertyMask *	pm,
				int		c )
    {
    int			prop;

    for ( prop= 0; prop < c; prop++ )
	{ PROPmaskADD( pm, prop ); }

    return;
    }

int utilPropMaskIsEmpty(	const PropertyMask *	pm )
    {
    int		byte;

    if  ( ! pm )
	{ XDEB(pm); return 1;	}

    for ( byte= 0; byte < PROPmaskSIZE; byte++ )
	{
	if  ( pm->pmBits[byte] )
	    { return 0;	}
	}

    return 1;
    }

void utilPropMaskOr(		PropertyMask *		pm0,
				const PropertyMask *	pm1,
				const PropertyMask *	pm2 )
    {
    int		byte;

    for ( byte= 0; byte < PROPmaskSIZE; byte++ )
	{ pm0->pmBits[byte]= pm1->pmBits[byte] | pm2->pmBits[byte]; }

    return;
    }

void utilPropMaskAnd(		PropertyMask *		pm0,
				const PropertyMask *	pm1,
				const PropertyMask *	pm2 )
    {
    int		byte;

    for ( byte= 0; byte < PROPmaskSIZE; byte++ )
	{ pm0->pmBits[byte]= pm1->pmBits[byte] & pm2->pmBits[byte]; }

    return;
    }

void utilPropMaskNot(		PropertyMask *		pm0,
				const PropertyMask *	pm1 )
    {
    int		byte;

    for ( byte= 0; byte < PROPmaskSIZE; byte++ )
	{ pm0->pmBits[byte]= ~pm1->pmBits[byte];	}

    return;
    }