AsmJsMath.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 Js
  7. {
  8. class AsmJsMath
  9. {
  10. public:
  11. template<typename T> static T Add( T aLeft, T aRight );
  12. template<typename T> static T Sub( T aLeft, T aRight );
  13. template<typename T> static T Mul( T aLeft, T aRight );
  14. template<typename T> static bool DivWouldTrap(T aLeft, T aRight);
  15. template<typename T> static T DivUnsafe(T aLeft, T aRight);
  16. template<typename T> static T DivChecked(T aLeft, T aRight);
  17. template<typename T> static bool RemWouldTrap(T aLeft, T aRight);
  18. template<typename T> static T RemUnsafe(T aLeft, T aRight);
  19. template<typename T> static T RemChecked(T aLeft, T aRight);
  20. template<typename T> static T Min( T aLeft, T aRight );
  21. template<typename T> static T Max( T aLeft, T aRight );
  22. template<typename T> static T Abs( T aLeft );
  23. template<typename T = int> static T And( T aLeft, T aRight );
  24. template<typename T = int> static T Or( T aLeft, T aRight );
  25. template<typename T = int> static T Xor( T aLeft, T aRight );
  26. template<typename T = int> static T Shl( T aLeft, T aRight );
  27. template<typename T = int> static T Shr( T aLeft, T aRight );
  28. template<typename T = int> static T ShrU( T aLeft, T aRight );
  29. template<typename T> static T Neg( T aLeft);
  30. static int Not( int aLeft);
  31. static int LogNot( int aLeft);
  32. static int ToBool( int aLeft );
  33. static int Clz32( int value);
  34. template<typename T> static int CmpLt( T aLeft, T aRight );
  35. template<typename T> static int CmpLe( T aLeft, T aRight );
  36. template<typename T> static int CmpGt( T aLeft, T aRight );
  37. template<typename T> static int CmpGe( T aLeft, T aRight );
  38. template<typename T> static int CmpEq( T aLeft, T aRight );
  39. template<typename T> static int CmpNe( T aLeft, T aRight );
  40. };
  41. }
  42. #include "AsmJsMath.inl"