vector_ulp.inl 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. namespace glm
  2. {
  3. template<length_t L, typename T, qualifier Q>
  4. GLM_FUNC_QUALIFIER vec<L, T, Q> next_float(vec<L, T, Q> const& x)
  5. {
  6. vec<L, T, Q> Result;
  7. for(length_t i = 0, n = Result.length(); i < n; ++i)
  8. Result[i] = next_float(x[i]);
  9. return Result;
  10. }
  11. template<length_t L, typename T, qualifier Q>
  12. GLM_FUNC_QUALIFIER vec<L, T, Q> next_float(vec<L, T, Q> const& x, int ULPs)
  13. {
  14. vec<L, T, Q> Result;
  15. for(length_t i = 0, n = Result.length(); i < n; ++i)
  16. Result[i] = next_float(x[i], ULPs);
  17. return Result;
  18. }
  19. template<length_t L, typename T, qualifier Q>
  20. GLM_FUNC_QUALIFIER vec<L, T, Q> next_float(vec<L, T, Q> const& x, vec<L, int, Q> const& ULPs)
  21. {
  22. vec<L, T, Q> Result;
  23. for(length_t i = 0, n = Result.length(); i < n; ++i)
  24. Result[i] = next_float(x[i], ULPs[i]);
  25. return Result;
  26. }
  27. template<length_t L, typename T, qualifier Q>
  28. GLM_FUNC_QUALIFIER vec<L, T, Q> prev_float(vec<L, T, Q> const& x)
  29. {
  30. vec<L, T, Q> Result;
  31. for(length_t i = 0, n = Result.length(); i < n; ++i)
  32. Result[i] = prev_float(x[i]);
  33. return Result;
  34. }
  35. template<length_t L, typename T, qualifier Q>
  36. GLM_FUNC_QUALIFIER vec<L, T, Q> prev_float(vec<L, T, Q> const& x, int ULPs)
  37. {
  38. vec<L, T, Q> Result;
  39. for(length_t i = 0, n = Result.length(); i < n; ++i)
  40. Result[i] = prev_float(x[i], ULPs);
  41. return Result;
  42. }
  43. template<length_t L, typename T, qualifier Q>
  44. GLM_FUNC_QUALIFIER vec<L, T, Q> prev_float(vec<L, T, Q> const& x, vec<L, int, Q> const& ULPs)
  45. {
  46. vec<L, T, Q> Result;
  47. for(length_t i = 0, n = Result.length(); i < n; ++i)
  48. Result[i] = prev_float(x[i], ULPs[i]);
  49. return Result;
  50. }
  51. template<length_t L, qualifier Q>
  52. GLM_FUNC_QUALIFIER vec<L, int, Q> float_distance(vec<L, float, Q> const& x, vec<L, float, Q> const& y)
  53. {
  54. vec<L, int, Q> Result;
  55. for(length_t i = 0, n = Result.length(); i < n; ++i)
  56. Result[i] = float_distance(x[i], y[i]);
  57. return Result;
  58. }
  59. template<length_t L, qualifier Q>
  60. GLM_FUNC_QUALIFIER vec<L, int64, Q> float_distance(vec<L, double, Q> const& x, vec<L, double, Q> const& y)
  61. {
  62. vec<L, int64, Q> Result;
  63. for(length_t i = 0, n = Result.length(); i < n; ++i)
  64. Result[i] = float_distance(x[i], y[i]);
  65. return Result;
  66. }
  67. }//namespace glm