| 47 | |
| 48 | template<typename T1, typename T2> |
| 49 | long bitWiseLogDivergence(const std::string type, const T1& lhs, const T2& rhs, bool displayAllDivergences, long divergentBytesTotal) |
| 50 | { |
| 51 | static_assert(sizeof(T1) == sizeof(T2)); |
| 52 | |
| 53 | std::span<const std::byte> bytesSpanLhs = getBytesSpan(lhs); |
| 54 | std::span<const std::byte> bytesSpanRhs = getBytesSpan(rhs); |
| 55 | |
| 56 | size_t size = bytesSpanLhs.size(); |
| 57 | |
| 58 | for (size_t offset = 0; offset < size; offset++) |
| 59 | { |
| 60 | if (bytesSpanLhs[offset] != bytesSpanRhs[offset]) |
| 61 | { |
| 62 | if (divergentBytesTotal == 0) |
| 63 | { |
| 64 | Logging::info("DIVERGENCE"); |
| 65 | Logging::info("TYPE: {}", type); |
| 66 | } |
| 67 | if (displayAllDivergences || divergentBytesTotal == 0) |
| 68 | { |
| 69 | Logging::info(" OFFSET: {}", offset); |
| 70 | Logging::info(" LHS: {:#x}", bytesSpanLhs[offset]); |
| 71 | Logging::info(" RHS: {:#x}", bytesSpanRhs[offset]); |
| 72 | } |
| 73 | divergentBytesTotal++; |
| 74 | } |
| 75 | } |
| 76 | return divergentBytesTotal; |
| 77 | } |
| 78 | |
| 79 | template<typename T1, typename T2> |
| 80 | bool isLoggedDivergence(const std::string type, const T1& lhs, const T2& rhs, bool displayAllDivergences) |
no test coverage detected