{"ScriptPreparationCode":null,"TestCases":[{"Name":"dataview","Code":"// Creating an ArrayBuffer with the same data: [32-bit int, 16-bit int, 32-bit int]\r\n// Using the same values for comparison: 1234567890, 12345, and 987654321\r\nconst buffer = new ArrayBuffer(10); // 4 bytes for int32, 2 bytes for int16, 4 bytes for another int32\r\nconst dataView = new DataView(buffer);\r\n\r\n// Populating the buffer with our example data in little-endian format\r\ndataView.setInt32(0, 1234567890, true); // 32-bit int at offset 0\r\ndataView.setInt16(4, 12345, true); // 16-bit int at offset 4\r\ndataView.setInt32(6, 987654321, true); // 32-bit int at offset 6\r\n\r\n// Reading the integers using DataView\r\nconst int32_1 = dataView.getInt32(0, true); // First 32-bit integer, little-endian\r\nconst int16 = dataView.getInt16(4, true); // 16-bit integer, little-endian\r\nconst int32_2 = dataView.getInt32(6, true); // Second 32-bit integer, little-endian\r\n\r\nconsole.log(int32_1); // Outputs: 1234567890\r\nconsole.log(int16); // Outputs: 12345\r\nconsole.log(int32_2); // Outputs: 987654321\r\n","IsDeferred":false},{"Name":"uint8array","Code":"// Example buffer containing [32-bit int, 16-bit int, 32-bit int]\r\n// For demonstration, let\u0027s create a buffer that represents the integers 1234567890 (0x499602D2), 12345 (0x3039), and 987654321 (0x3ADE68B1) in little-endian format\r\nconst bytes = new Uint8Array([\r\n 0xD2, 0x02, 0x96, 0x49, // 1234567890 in little-endian\r\n 0x39, 0x30, // 12345 in little-endian\r\n 0xB1, 0x68, 0xDE, 0x3A // 987654321 in little-endian\r\n]);\r\n\r\n// Function to read a 32-bit integer from a byte offset, assuming little-endian\r\nfunction readInt32LE(bytes, offset) {\r\n return (bytes[offset] | (bytes[offset \u002B 1] \u003C\u003C 8) | (bytes[offset \u002B 2] \u003C\u003C 16) | (bytes[offset \u002B 3] \u003C\u003C 24)) \u003E\u003E\u003E 0;\r\n}\r\n\r\n// Function to read a 16-bit integer from a byte offset, assuming little-endian\r\nfunction readInt16LE(bytes, offset) {\r\n return bytes[offset] | (bytes[offset \u002B 1] \u003C\u003C 8);\r\n}\r\n\r\n// Extracting the integers\r\nconst int32_1 = readInt32LE(bytes, 0); // First 32-bit integer\r\nconst int16 = readInt16LE(bytes, 4); // 16-bit integer\r\nconst int32_2 = readInt32LE(bytes, 6); // Second 32-bit integer\r\n\r\nconsole.log(int32_1); // Outputs: 1234567890\r\nconsole.log(int16); // Outputs: 12345\r\nconsole.log(int32_2); // Outputs: 987654321\r\n","IsDeferred":false}]}