rot.js 729 B

12345678910111213
  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. var mod = new WebAssembly.Module(readbuffer('rot.wasm'));
  6. var a = new WebAssembly.Instance(mod).exports;
  7. print(a.rotl(11,2)); // == 44
  8. print(a.rotl(65536,2)); // == 262144
  9. print(a.rotr(65536,2)); // == 16384
  10. print(a.rotl(0xff00, 24)); // == 255
  11. print(a.rotl(0x80000000, 2)); // == 2
  12. print(a.rotr(0x00000001, 1)); // == -2147483648