1 /* GDC -- D front-end for GCC
2 Copyright (C) 2004 David Friedman
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 dtval(dt_t
** pdt
, DT t
, integer_t i
, void * p
)
34 dtcat(dt_t
** pdt
, dt_t
* d
)
37 // wasted time and mem touching... shortcut DTend field?
39 pdt
= & (*pdt
)->DTnext
;
44 typedef unsigned bitunit_t
;
47 dtnbits(dt_t
** pdt
, size_t count
, char * pbytes
, unsigned unit_size
)
49 assert(unit_size
== sizeof(bitunit_t
));
50 assert(count
% unit_size
== 0);
52 bitunit_t
* p_unit
= (bitunit_t
*) pbytes
,
53 * p_unit_end
= (bitunit_t
*) (pbytes
+ count
);
54 char * pbits
= new char[count
];
59 while (p_unit
< p_unit_end
) {
60 bitunit_t inv
= *p_unit
++;
62 for (unsigned i
= 0; i
< sizeof(bitunit_t
)*8; i
++) {
63 outv
|= ((inv
>> i
) & 1) << b
;
71 assert( (unsigned)(p_out
- pbits
) == count
);
73 return dtnbytes(pdt
, count
, pbits
);