rename copyIntoType -> copyInto
Also add set and splat methods to vector types
Signed-off-by: John McCutchan <john@johnmccutchan.com>
diff --git a/gen/matrix_generator.dart b/gen/matrix_generator.dart
index 8ad1425..78b235b 100644
--- a/gen/matrix_generator.dart
+++ b/gen/matrix_generator.dart
@@ -1143,7 +1143,7 @@
iPop();
iPrint('}');
- iPrint('$matType copyIntoMatrix($matType arg) {');
+ iPrint('$matType copyInto($matType arg) {');
iPush();
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
@@ -1154,7 +1154,7 @@
iPop();
iPrint('}');
- iPrint('$matType copyFromMatrix($matType arg) {');
+ iPrint('$matType copyFrom($matType arg) {');
iPush();
for (int i = 0; i < cols; i++) {
for (int j = 0; j < rows; j++) {
diff --git a/gen/vector_generator.dart b/gen/vector_generator.dart
index 007a089..dd5cfa1 100644
--- a/gen/vector_generator.dart
+++ b/gen/vector_generator.dart
@@ -193,23 +193,15 @@
}
void generateSplat() {
- /*
- String constructor = '$generatedName.splat($vectorType a) : ';
- bool first = true;
- vectorComponents.forEach((comp) {
- constructor += first ? '$comp = a' : ', $comp = a';
- first = false;
- });
- constructor += ';';
- iPrint(constructor);
- iPrint('void splat($vectorType a) {');
+ iPrint('\/\/\/ Splats a scalar into all lanes of the vector.');
+ iPrint('$generatedName splat(num arg) {');
iPush();
- vectorComponents.forEach((comp) {
- iPrint('$comp = a;');
- });
+ for (String c in vectorComponents) {
+ iPrint('$c = arg;');
+ }
+ iPrint('return this;');
iPop();
iPrint('}');
- */
}
void generateOperator(String op) {
@@ -593,7 +585,7 @@
iPrint('return c;');
iPop();
iPrint('}');
- iPrint('$generatedName copyIntoVector($generatedName arg) {');
+ iPrint('$generatedName copyInto($generatedName arg) {');
iPush();
for (String c in vectorComponents) {
iPrint('arg.$c = $c;');
@@ -602,7 +594,18 @@
iPop();
iPrint('}');
- iPrint('$generatedName copyFromVector($generatedName arg) {');
+ iPrint('$generatedName copyFrom($generatedName arg) {');
+ iPush();
+ for (String c in vectorComponents) {
+ iPrint('$c = arg.$c;');
+ }
+ iPrint('return this;');
+ iPop();
+ iPrint('}');
+ }
+
+ void generateSet() {
+ iPrint('$generatedName set($generatedName arg) {');
iPush();
for (String c in vectorComponents) {
iPrint('$c = arg.$c;');
@@ -724,6 +727,7 @@
generateSelfNegate();
generateSelfAbsolute();
generateCopy();
+ generateSet();
generateBuffer();
generateEpilogue();
}