| 20 | { |
| 21 | |
| 22 | bool |
| 23 | equalBitPatterns (const char* b1, const char* b2) |
| 24 | { |
| 25 | // |
| 26 | // Returns true if the characters in zero-terminated string b1 |
| 27 | // are the same as the charaters in string b2, except for places |
| 28 | // where b1 or b2 contains an 'X'. For example: |
| 29 | // |
| 30 | // equalBitPatterns ("100", "100") returns true |
| 31 | // equalBitPatterns ("100", "101") returns false |
| 32 | // equalBitPatterns ("10X", "101") returns true |
| 33 | // equalBitPatterns ("10X", "100") returns true |
| 34 | // |
| 35 | |
| 36 | while (*b1 && *b2) |
| 37 | { |
| 38 | if (*b1 != *b2 && *b1 != 'X' && *b2 != 'X') return false; |
| 39 | |
| 40 | ++b1; |
| 41 | ++b2; |
| 42 | } |
| 43 | |
| 44 | return !(*b1 || *b2); |
| 45 | } |
| 46 | |
| 47 | void |
| 48 | testBits (float f, const char bh[19], const char bg[35]) |