1 /* Implement POWERSET runtime actions for CHILL.
2 Copyright (C) 1992,1993 Free Software Foundation, Inc.
3 Author: Wilfried Moser, et al
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
27 * function __ltpowerset
32 * bitlength length of powerset
35 * int 1 .. left is proper subset of right
36 * (excludes case where left == right)
40 * check if one powerset is included in another
44 __ltpowerset (left, right, bitlength)
47 unsigned long bitlength;
49 if (bitlength <= SET_CHAR_SIZE)
51 if ((*((SET_CHAR *)left) & *((SET_CHAR *)right))
52 != *((SET_CHAR *)left))
54 if (*((SET_CHAR *)left) != *((SET_CHAR *)right))
58 else if (bitlength <= SET_SHORT_SIZE)
60 if ((*((SET_SHORT *)left) & *((SET_SHORT *)right))
61 != *((SET_SHORT *)left))
63 if (*((SET_SHORT *)left) != *((SET_SHORT *)right))
69 SET_WORD *endp = left + BITS_TO_WORDS(bitlength);
70 int all_equal = 1; /* assume all bits are equal */
74 if ((*right & *left) != *left)
81 if (left == endp && all_equal) /* exclude TRUE return for == case */