MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / equalBitPatterns

Function equalBitPatterns

src/ImathTest/testBitPatterns.cpp:22–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20{
21
22bool
23equalBitPatterns (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
47void
48testBits (float f, const char bh[19], const char bg[35])

Callers 1

testBitsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected