★ wanayoo — archive 1999 https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/SIMD/storeNouvelle recherche | Portail wanayoo

SIMD.%type%.store()

par 1 contributeur :

Cette fonctionnalité fait partie des propositions pour Harmony (ECMAScript7) et est donc expérimentale.
Cette spécification technique n'a pas encore été stabilisée, veuillez consulter le tableau de compatibilité pour plus d'informations sur les éventuelles différences entre les navigateurs. Il convient de noter qu'une fonctionnalité expérimentale peut voir sa syntaxe ou son comportement modifié dans le futur, en fonction des évolutions de la spécification.

La méthode statique SIMD.%type%.store() permet d'enregistrer un vecteur SIMD dans un tableau typé.

Syntax

SIMD.Float32x4.store(tarray, index, valeur)
SIMD.Float32x4.store1(tarray, index, valeur)
SIMD.Float32x4.store2(tarray, index, valeur)
SIMD.Float32x4.store3(tarray, index, valeur)

SIMD.Int32x4.store(tarray, index, valeur)
SIMD.Int32x4.store1(tarray, index, valeur)
SIMD.Int32x4.store2(tarray, index, valeur)
SIMD.Int32x4.store3(tarray, index, valeur)

SIMD.Float64x2.store(tarray, index, valeur)
SIMD.Float64x2.store1(tarray, index, valeur)

SIMD.Int8x16.store(tarray, index, valeur)
SIMD.Int16x8.store(tarray, index, valeur)

Paramètres

tarray
Une instance d'un tableau typé. Cela peut être un :
index
L'indice du tableau typé à partir duquel on souhaite enregistrer les données.
valeur
Une instance d'un type SIMD qu'on souhaite enregistrer dans un tableau typé.

Exceptions levées

  • Si index est en dehors de l'intervalle valide, par exemple avec SIMD.Int32x4.store(tarray, -1, valeur) ou s'il est supérieur à la taille de tarray, cela provoquera une exception RangeError.
  • Si tarray n'est pas une instance d'un des types de tableaux typés, par exemple SIMD.Int32x4.store(tarray.buffer, 0) (un buffer n'est pas accepté ici), cela provoquera une exception TypeError.

Valeur de retour

La valeur qui a été enregistré (un vecteur SIMD).

Description

Les méthodes SIMD load et store permettent d'interagir avec les tableaux typés. La méthode load permet de charger des tableaux typés dans des vecteurs SIMD, la méthode store permet d'enregistrer des données SIMD dans des tableaux typés.

La méthode store() permet d'enregistrer toutes les voies du vecteurs, si on souhaite n'enregistrer qu'une, deux ou trois valeurs, on pourra respectivement utiliser les méthodes store1(), store2() ou store3().

Exemples

Dans les exemples suivants, on utilise un vecteur SIMD.Int32x4 qu'on enregistre dans un tableau typé Int32Array.

Enregistrer toutes les valeurs

var tarray = new Int32Array(8);
var value = SIMD.Int32x4(1, 2, 3, 4);
SIMD.Int32x4.store(tarray, 0, value);
// tarray = Int32Array[1, 2, 3, 4, 0, 0, 0, 0]

var tarray = new Int32Array(8);
var value = SIMD.Int32x4(1, 2, 3, 4);
SIMD.Int32x4.store(tarray, 2, value);
// tarray = Int32Array[0, 0, 1, 2, 3, 4, 0, 0]

Enregistrer une valeur

var tarray = new Int32Array(8);
var value = SIMD.Int32x4(1, 2, 3, 4);
SIMD.Int32x4.store1(tarray, 0, value);
// tarray = Int32Array[1, 0, 0, 0, 0, 0, 0, 0]

var tarray = new Int32Array(8);
var value = SIMD.Int32x4(1, 2, 3, 4);
SIMD.Int32x4.store1(tarray, 2, value);
// tarray = Int32Array[0, 0, 1, 0, 0, 0, 0, 0]

Enregistrer deux valeurs

var tarray = new Int32Array(8);
var value = SIMD.Int32x4(1, 2, 3, 4);
SIMD.Int32x4.store2(tarray, 0, value);
// tarray = Int32Array[1, 2, 0, 0, 0, 0, 0, 0]

var tarray = new Int32Array(8);
var value = SIMD.Int32x4(1, 2, 3, 4);
SIMD.Int32x4.store2(tarray, 2, value);
// tarray = Int32Array[0, 0, 1, 2, 0, 0, 0, 0]

Enregistrer trois valeurs

var tarray = new Int32Array(8);
var value = SIMD.Int32x4(1, 2, 3, 4);
SIMD.Int32x4.store3(tarray, 0, value);
// tarray = Int32Array[1, 2, 3, 0, 0, 0, 0, 0]

var tarray = new Int32Array(8);
var value = SIMD.Int32x4(1, 2, 3, 4);
SIMD.Int32x4.store3(tarray, 2, value);
// tarray = Int32Array[0, 0, 1, 2, 3, 0, 0, 0]

Spécifications

Spécification Statut Commentaires
SIMD
La définition de 'SIMDConstructor.store' dans cette spécification.
Projet Définition initiale.

Compatibilité des navigateurs

Fonctionnalité Chrome Firefox (Gecko) Internet Explorer Opera Safari
Support simple Pas de support Nightly build Pas de support Pas de support Pas de support
Fonctionnalité Android Chrome pour Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Support simple Pas de support Pas de support Nightly build Pas de support Pas de support Pas de support

Voir aussi

Étiquettes et contributeurs liés au document

Contributeurs à cette page : SphinxKnight
Dernière mise à jour par : SphinxKnight,
Masquer la barre latérale