Rewrite strncmp with compact implementation