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
);
34 * bitlength length of bitstring in bits
35 * startbit starting bitnumber
36 * endbit ending bitnumber
45 * set all bits from starting bitnumber to ending bitnumber
50 __setbits (out
, bitlength
, startbit
, endbit
)
52 unsigned long bitlength
;
60 || startbit
>= bitlength
62 || endbit
>= bitlength
64 __cause_ex1 ("rangefail", "__setbits", __LINE__
);
66 if (bitlength
<= SET_CHAR_SIZE
)
67 for (i
= startbit
; i
<= endbit
; i
++)
68 SET_BIT_IN_CHAR (*((SET_CHAR
*)out
), i
);
69 else if (bitlength
<= SET_SHORT_SIZE
)
70 for (i
= startbit
; i
<= endbit
; i
++)
71 SET_BIT_IN_SHORT (*((SET_SHORT
*)out
), i
);
77 /* FIXME - this is inefficient! */
78 for (i
= startbit
; i
<= endbit
; i
++)
80 p
= out
+ (i
/ SET_WORD_SIZE
);
81 bitnr
= i
% SET_WORD_SIZE
;
82 SET_BIT_IN_WORD (*p
, bitnr
);