25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

49 lines
1.1 KiB

  1. //
  2. // Lol Engine - Benchmark program
  3. //
  4. // Copyright: (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://sam.zoy.org/projects/COPYING.WTFPL for more details.
  9. //
  10. #if defined HAVE_CONFIG_H
  11. # include "config.h"
  12. #endif
  13. #include "core.h"
  14. #include "loldebug.h"
  15. using namespace std;
  16. using namespace lol;
  17. int main(int argc, char **argv)
  18. {
  19. Timer timer;
  20. uint16_t total = 0;
  21. for (uint32_t i = 0; i < 0xffffffffu; i++)
  22. {
  23. union { float f; uint32_t x; } u;
  24. u.x = i;
  25. half h = half::makeslow(u.f);
  26. total ^= h.bits();
  27. }
  28. Log::Info("time for makeslow: %f (hash %04x)\n", timer.GetMs(), total);
  29. for (uint32_t i = 0; i < 0xffffffffu; i++)
  30. {
  31. union { float f; uint32_t x; } u;
  32. u.x = i;
  33. half h = half::makefast(u.f);
  34. total ^= h.bits();
  35. }
  36. Log::Info("time for makefast: %f (hash %04x)\n", timer.GetMs(), total);
  37. return EXIT_SUCCESS;
  38. }