You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

60 line
1.4 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. float ftotal = 0.0f;
  21. for (uint32_t i = 0; i < 0xffffffffu; i += 7)
  22. {
  23. union { float f; uint32_t x; } u;
  24. u.x = i;
  25. float h = (float)half::makefast(u.f);
  26. ftotal += h;
  27. }
  28. Log::Info("time for makeslow: %f (hash %f)\n", timer.GetMs(), ftotal);
  29. uint16_t total = 0;
  30. for (uint32_t i = 0; i < 0xffffffffu; i += 7)
  31. {
  32. union { float f; uint32_t x; } u;
  33. u.x = i;
  34. half h = half::makeslow(u.f);
  35. total ^= h.bits();
  36. }
  37. Log::Info("time for makeslow: %f (hash %04x)\n", timer.GetMs(), total);
  38. for (uint32_t i = 0; i < 0xffffffffu; i += 7)
  39. {
  40. union { float f; uint32_t x; } u;
  41. u.x = i;
  42. half h = half::makefast(u.f);
  43. total ^= h.bits();
  44. }
  45. Log::Info("time for makefast: %f (hash %04x)\n", timer.GetMs(), total);
  46. return EXIT_SUCCESS;
  47. }