|
|
|
6. Let offset be O .[[ByteOffset]]. 7. Return offset ). The initial value of .prototype.constructor is the intrinsic object. The interpretation and use of the arguments of .prototype.copyWithin are the same as for Array.prototype.copyWithin Array.prototype.copyWithin as defined in . The following steps are taken: 1. Let O be the this value. 2. Perform ? ( O ). 3. Let len be O .[[ArrayLength]]. 4. Let relativeTarget be ? ( target ). 5. If relativeTarget is - ∞ , let to be 0. 6. Else if relativeTarget < 0, let to be ( len + relativeTarget , 0). 7. Else, let to ( relativeTarget , len ). 8. Let relativeStart start ). 9. If relativeStart is - ∞ , let from be 0. 10. Else if relativeStart < 0, let from len + relativeStart , 0). 11. Else, let from ( relativeStart , len ). 12. If end is undefined , let relativeEnd be len ; else let relativeEnd ( end ). 13. If relativeEnd is - ∞ , let final be 0. 14. Else if relativeEnd < 0, let final len + relativeEnd , 0). 15. Else, let final ( relativeEnd , len ). 16. Let count be ( final - from , len - to ). 17. If count > 0, then a. NOTE: The copying must be performed in a manner that preserves the bit-level encoding of the source data. b. Let buffer be O .[[ViewedArrayBuffer]]. c. If ( buffer ) is true , throw a TypeError exception. d. Let typedArrayName be the String value of O .[[TypedArrayName]]. e. Let elementSize be the Element Size value specified in typedArrayName . f. Let byteOffset be O .[[ByteOffset]]. g. Let toByteIndex be to
×
elementSize + byteOffset . h. Let fromByteIndex be from
×
elementSize + byteOffset . i. Let countBytes be count
×
elementSize . j. If fromByteIndex < toByteIndex and toByteIndex < fromByteIndex + countBytes , then i. Let direction be -1. ii. Set fromByteIndex to fromByteIndex + countBytes - 1. iii. Set toByteIndex to toByteIndex + countBytes - 1. k. Else, i. Let direction be 1. l. Repeat, while countBytes > 0, 23.2.3.4 %TypedArray%.prototype.constructor 23.2.3.5 %TypedArray%.prototype.copyWithin ( target , start [ , end ] ) 669 |