WasmMath.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft Corporation and contributors. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. namespace Wasm
  7. {
  8. class WasmMath
  9. {
  10. public:
  11. template<typename T> static int Eqz(T value);
  12. template<typename T> static T Shl( T aLeft, T aRight );
  13. template<typename T> static T Shr( T aLeft, T aRight );
  14. template<typename T> static T ShrU( T aLeft, T aRight );
  15. template<typename T> static T Copysign(T aLeft, T aRight);
  16. template<typename T> static T Trunc(T aLeft);
  17. template<typename T> static T Nearest(T aLeft);
  18. template<typename T> static T PopCnt(T value);
  19. template<typename T> static T Ctz(T value);
  20. template<typename T> static T Clz(T value);
  21. template<typename T> static T Rol(T aLeft, T aRight);
  22. template<typename T> static T Ror(T aLeft, T aRight);
  23. template <typename T> bool static LessThan(T aLeft, T aRight);
  24. template <typename T> bool static LessOrEqual(T aLeft, T aRight);
  25. template <typename T> using CmpPtr = bool(*)(T a, T b);
  26. template <typename STYPE, typename UTYPE, UTYPE MAX, UTYPE NEG_ZERO, UTYPE NEG_ONE, CmpPtr<UTYPE> CMP1, CmpPtr<UTYPE> CMP2> static bool isInRange(STYPE srcVal);
  27. template <typename STYPE> static bool isNaN(STYPE src);
  28. };
  29. } //namespace Wasm
  30. #include "WasmMath.inl"