Last change
on this file since 127 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:
706 bytes
|
Rev | Line | |
---|
[117] | 1 | /* +++Date last modified: 05-Jul-1997 */ |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | ** Make an ascii binary string into an integer. |
---|
| 5 | ** |
---|
| 6 | ** Public domain by Bob Stout |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include <string.h> |
---|
| 10 | #include "bitcount-bitops.h" |
---|
| 11 | |
---|
| 12 | unsigned int bstr_i(char *cptr) |
---|
| 13 | { |
---|
| 14 | unsigned int i, j = 0; |
---|
| 15 | |
---|
| 16 | while (cptr && *cptr && strchr("01", *cptr)) |
---|
| 17 | { |
---|
| 18 | i = *cptr++ - '0'; |
---|
| 19 | j <<= 1; |
---|
| 20 | j |= (i & 0x01); |
---|
| 21 | } |
---|
| 22 | return(j); |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | #ifdef TEST |
---|
| 26 | |
---|
| 27 | #include <stdlib.h> |
---|
| 28 | |
---|
| 29 | int main(int argc, char *argv[]) |
---|
| 30 | { |
---|
| 31 | char *arg; |
---|
| 32 | unsigned int x; |
---|
| 33 | |
---|
| 34 | while (--argc) |
---|
| 35 | { |
---|
| 36 | x = bstr_i(arg = *++argv); |
---|
| 37 | printf("Binary %s = %d = %04Xh\n", arg, x, x); |
---|
| 38 | } |
---|
| 39 | return EXIT_SUCCESS; |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | #endif /* TEST */ |
---|
Note: See
TracBrowser
for help on using the repository browser.