Avoid using memcmp and compare members directly

This should avoid false positives from struct padding bits.