]>
gcc.gnu.org Git - gcc.git/blob - libchill/eqps.c
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. */
28 * function __eqpowerset
32 * right right powerset
33 * bitlength length of powerset in bits
36 * 1 if powersets are equal, bit for bit
42 * compares two powersets for equality
46 __eqpowerset (left
, right
, bitlength
)
49 unsigned long bitlength
;
52 if (bitlength
<= SET_CHAR_SIZE
)
54 SET_CHAR c
= *(SET_CHAR
*)left
^ *(SET_CHAR
*)right
;
55 MASK_UNUSED_CHAR_BITS (&c
, bitlength
);
56 return (c
== 0) ? 1 : 0;
58 else if (bitlength
<= SET_SHORT_SIZE
)
60 SET_SHORT c
= *(SET_SHORT
*)left
^ *(SET_SHORT
*)right
;
61 MASK_UNUSED_SHORT_BITS (&c
, bitlength
);
62 return (c
== 0) ? 1 : 0;
64 else if (bitlength
<= SET_WORD_SIZE
)
66 SET_WORD c
= *(SET_WORD
*)left
^ *(SET_WORD
*)right
;
67 MASK_UNUSED_WORD_BITS (&c
, bitlength
% SET_WORD_SIZE
);
68 return (c
== 0) ? 1 : 0;
74 register unsigned long i
;
75 unsigned long len
= bitlength
/ SET_WORD_SIZE
;
77 for (i
= 0; i
< len
; i
++) /* a word-oriented memcmp */
78 if (left
[i
] != right
[i
])
80 /* do the last (possibly partial) word */
81 bitlength
%= SET_WORD_SIZE
;
84 c
= left
[i
] ^ right
[i
];
85 MASK_UNUSED_WORD_BITS (&c
, bitlength
);
86 return (c
== 0) ? 1 : 0;
This page took 0.050237 seconds and 6 git commands to generate.