Last change
on this file since 118 was
117,
checked in by rosiere, 15 years ago
|
1) Platforms : add new organization for test
2) Load_Store_Unit : add array to count nb_check in store_queue
3) Issue_queue and Core_Glue : rewrite the issue network
4) Special_Register_Unit : add reset value to register CID
5) Softwares : add multicontext test
6) Softwares : add SPECINT
7) Softwares : add MiBench?
7) Read_queue : inhib access for r0
8) Change Core_Glue (network) - dont yet support priority and load balancing scheme
|
-
Property svn:executable set to
*
-
Property svn:keywords set to
Id
|
File size:
823 bytes
|
Rev | Line | |
---|
[117] | 1 | /* +++Date last modified: 05-Jul-1997 */ |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | ** Functions to maintain an arbitrary length array of bits |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #include "bitcount-bitops.h" |
---|
| 8 | |
---|
| 9 | char *alloc_bit_array(size_t bits) |
---|
| 10 | { |
---|
| 11 | char *set = calloc((bits + CHAR_BIT - 1) / CHAR_BIT, sizeof(char)); |
---|
| 12 | |
---|
| 13 | return set; |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | int getbit(char *set, int number) |
---|
| 17 | { |
---|
| 18 | set += number / CHAR_BIT; |
---|
| 19 | return (*set & (1 << (number % CHAR_BIT))) != 0; /* 0 or 1 */ |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | void setbit(char *set, int number, int value) |
---|
| 23 | { |
---|
| 24 | set += number / CHAR_BIT; |
---|
| 25 | if (value) |
---|
| 26 | *set |= 1 << (number % CHAR_BIT); /* set bit */ |
---|
| 27 | else *set &= ~(1 << (number % CHAR_BIT)); /* clear bit*/ |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | void flipbit(char *set, int number) |
---|
| 31 | { |
---|
| 32 | set += number / CHAR_BIT; |
---|
| 33 | *set ^= 1 << (number % CHAR_BIT); /* flip bit */ |
---|
| 34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.