That snippet appears to be out of date. Version 0.8.34 does something similar to what you suggest.
#define ngx_str3Ocmp(m, c0, c1, c2, c3) \
*(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)