efi_selftest_util.c 417 B

12345678910111213141516171819202122232425
  1. /*
  2. * efi_selftest_util
  3. *
  4. * Copyright (c) 2017 Heinrich Schuchardt <xypron.glpk@gmx.de>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. *
  8. * Utility functions
  9. */
  10. #include <efi_selftest.h>
  11. int efi_st_memcmp(const void *buf1, const void *buf2, size_t length)
  12. {
  13. const u8 *pos1 = buf1;
  14. const u8 *pos2 = buf2;
  15. for (; length; --length) {
  16. if (*pos1 != *pos2)
  17. return *pos1 - *pos2;
  18. ++pos1;
  19. ++pos2;
  20. }
  21. return 0;
  22. }