User:Evilpie/Simd: Difference between revisions

Line 9: Line 9:


== 1. Simd.add(arrayA, indexA, arrayB, indexB, count) ==  
== 1. Simd.add(arrayA, indexA, arrayB, indexB, count) ==  
    1. If not arrayA is an object, throw TypeError
1. If not arrayA is an object, throw TypeError
    2. Let indexA be ToUint32(indexA)
2. Let indexA be ToUint32(indexA)
    3. If not arrayB is an object, throw TypeError
3. If not arrayB is an object, throw TypeError
    4. Let indexB be ToUint32(indexB)
4. Let indexB be ToUint32(indexB)
    4. Let count be ToUint32(count)
5. Let count be ToUint32(count)
    5. Throw TypeError, if arrayA is not a TypeArray (the class is either Float32Array, Float64 etc.)
6. Throw TypeError, if arrayA is not a TypeArray (the class is either Float32Array, Float64 etc.)
    6. Throw TypeError, if the internal property [[ Class ]] of arrayA is different from internal property [[ Class ]] of arrayB
7. Throw TypeError, if the internal property [[ Class ]] of arrayA is different from internal property [[ Class ]] of arrayB
    7. Throw RangeError if indexA + count is larger than the length of the arrayA
8. Throw RangeError if indexA + count is larger than the length of the arrayA
    8. Throw RangeError if indexB + count is larger than the length of the arrayB
9. Throw RangeError if indexB + count is larger than the length of the arrayB
    9. Let k be 0
10. Let k be 0
    10. Repeat, while k < count
11. Repeat, while k < count
        a. Let a be arrayA[indexA + k]
    a. Let a be arrayA[indexA + k]
        b. Let b be arrayB[indexB + k]
    b. Let b be arrayB[indexB + k]
        c. Assign a + b to arrayA[indexA + k]
    c. Assign a + b to arrayA[indexA + k]
        c. Increment k by one
    d. Increase k by 1


= Example =
= Example =
Confirmed users
149

edits