25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

47 satır
964 B

  1. //
  2. // Lol Engine — Sandbox program
  3. //
  4. // Copyright © 2005—2020 Sam Hocevar <sam@hocevar.net>
  5. //
  6. // This program is free software. It comes without any warranty, to
  7. // the extent permitted by applicable law. You can redistribute it
  8. // and/or modify it under the terms of the Do What the Fuck You Want
  9. // to Public License, Version 2, as published by the WTFPL Task Force.
  10. // See http://www.wtfpl.net/ for more details.
  11. //
  12. #if HAVE_CONFIG_H
  13. # include "config.h"
  14. #endif
  15. #include <lol/engine.h> // FIXME: for now this is required for SDL_main
  16. #include <lol/thread>
  17. #include <lol/bigint>
  18. using namespace lol;
  19. int main(int, char **)
  20. {
  21. timer t;
  22. bigint<128> x(17), y(23);
  23. x.print();
  24. y.print();
  25. auto z = x * y;
  26. z.print();
  27. for (int i = 0; i < 500000; ++i)
  28. {
  29. x = (bigint<128>)(x * x);
  30. x ^= y;
  31. }
  32. printf("%d %d\n", (int)x, (int)y);
  33. printf("Time: %f s\n", t.get());
  34. return EXIT_SUCCESS;
  35. }