
memory problems need boolean data type
Quote:
>Need help on memory problem.
>I am doing programming in VLSI. I am handling huge circuits of size
>10,000 lines. I have to declare arrays of size 1000 x 1000. In most of
>the arrays I will be storing only 1 or 0. So I need a boolean type so
>that I can conserve memory. I am running into memory problems when I
>run this program for large circuits. I could have done it with linked
>lists, since it was needed in a shortperiod of time I resorted to
>arrays. If anybody can help me out, I will be thankful to them.
>Rajani Koneru (Southern Illinois University).
It sounds like you need a bit map. Try writing some routines for a
generic one dimensional bit map. Then you can use an array of these
bitmaps to simulate your 1000x1000 array.
The basic idea behind the bit map is to declare an array of chars. You
can then set the Nth bit with
array[N>>8] |= 1 << (N&7);
Of course, this assumes characters are 8 bits long. It also assumes N
is unsigned, but you get the basic idea.
Dave
--
AT&T Bell Laboratories (908)946-1107
943 Holmdel Road
Holmdel, NJ 07733