Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. const myArray = new ArrayBuffer(0x800) // populated from elsewhere
  2. const readInt32 = (array, index) => {
  3. const typedArray = new Uint32Array(array, index, 1)
  4. return typedArray[0]
  5. }
  6. const writeInt32 = (array, index, value) => {
  7. const typedArray = new Uint32Array(array, index, 1)
  8. typedArray[0] = value
  9. }
  10.  
  11. const sourceAddress = readInt32(myArray, 0)
  12. const targetAddress = readInt32(myArray, 4)
  13. const value = readInt32(myArray, sourceAddress)
  14. writeInt32(myArray, targetAddress, value + 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement