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 extern void __cause_ex1 (char *exname
, char *file
, int lineno
);
30 * function __inbitstring
33 * bitno bit number within set
34 * powerset the powerset
35 * bitlength length of powerset in bits
36 * minval number of lowest bit stored
37 * fname filename of caller
38 * lineno linenumber of caller
48 * checks if a given value is included in a bitstring
52 __inbitstring (bitno
, powerset
, bitlength
, minval
, fname
, lineno
)
55 unsigned long bitlength
;
63 || (bitno
- minval
) >= bitlength
)
64 __cause_ex1 ("rangefail", fname
, lineno
);
67 if (bitlength
<= SET_CHAR_SIZE
)
68 return GET_BIT_IN_CHAR (*((SET_CHAR
*)powerset
), bitno
);
69 else if (bitlength
<= SET_SHORT_SIZE
)
70 return GET_BIT_IN_SHORT (*((SET_SHORT
*)powerset
), bitno
);
72 return GET_BIT_IN_WORD (powerset
[bitno
/ SET_WORD_SIZE
],
73 bitno
% SET_WORD_SIZE
);