unitybug.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. function AsmModule(glob) {
  6. "use asm";
  7. var fround = glob.Math.fround;
  8. function floatNeg(a) {
  9. a = fround(a);
  10. var e = fround(0);
  11. e = fround(-a);
  12. return fround(e);
  13. }
  14. function uintRem(a) {
  15. a = a|0;
  16. var b = 0;
  17. var c = 0;
  18. var d = 0;
  19. c = (a + d)|0;
  20. d = (a >>> 0) % 10 | 0;
  21. b = c;
  22. return b|0;
  23. }
  24. return {
  25. floatNeg:floatNeg,
  26. uintRem:uintRem
  27. }
  28. }
  29. var global = {Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,Infinity:Infinity, NaN:NaN}
  30. var module = AsmModule(global);
  31. print(module.floatNeg(3));
  32. print(module.uintRem(400));