OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // patch classes for Int8List ..... Float64List and ByteData implementations. | 5 // patch classes for Int8List ..... Float64List and ByteData implementations. |
6 | 6 |
7 import "dart:_internal"; | 7 import "dart:_internal"; |
8 import 'dart:math' show Random; | 8 import 'dart:math' show Random; |
9 | 9 |
10 patch class Int8List { | 10 patch class Int8List { |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 if (end == null) end = this.length; | 480 if (end == null) end = this.length; |
481 var length = end - start; | 481 var length = end - start; |
482 _rangeCheck(this.length, start, length); | 482 _rangeCheck(this.length, start, length); |
483 List result = _createList(length); | 483 List result = _createList(length); |
484 result.setRange(0, length, this, start); | 484 result.setRange(0, length, this, start); |
485 return result; | 485 return result; |
486 } | 486 } |
487 | 487 |
488 void setRange(int start, int end, Iterable from, [int skipCount = 0]) { | 488 void setRange(int start, int end, Iterable from, [int skipCount = 0]) { |
489 // Check ranges. | 489 // Check ranges. |
490 if ((start < 0) || (start > length)) { | 490 if (0 > start || start > end || end > length) { |
491 throw _newRangeError(start, length + 1); | 491 RangeError.checkValidRange(start, end, length); // Always throws. |
492 } | 492 assert(false); |
493 if ((end < 0) || (end > length)) { | |
494 throw _newRangeError(end, length + 1); | |
495 } | |
496 if (start > end) { | |
497 throw _newRangeError(start, end + 1); | |
498 } | 493 } |
499 if (skipCount < 0) { | 494 if (skipCount < 0) { |
500 throw new ArgumentError(skipCount); | 495 throw new ArgumentError(skipCount); |
501 } | 496 } |
502 | 497 |
503 final count = end - start; | 498 final count = end - start; |
504 if ((from.length - skipCount) < count) { | 499 if ((from.length - skipCount) < count) { |
505 throw IterableElementError.tooFew(); | 500 throw IterableElementError.tooFew(); |
506 } | 501 } |
507 | 502 |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 | 930 |
936 factory _Int8Array(int length) { | 931 factory _Int8Array(int length) { |
937 return _new(length); | 932 return _new(length); |
938 } | 933 } |
939 | 934 |
940 | 935 |
941 // Method(s) implementing List interface. | 936 // Method(s) implementing List interface. |
942 | 937 |
943 int operator[](int index) { | 938 int operator[](int index) { |
944 if (index < 0 || index >= length) { | 939 if (index < 0 || index >= length) { |
945 throw _newRangeError(index, length); | 940 throw new RangeError.index(index, this, "index"); |
946 } | 941 } |
947 return _getInt8(index); | 942 return _getInt8(index); |
948 } | 943 } |
949 | 944 |
950 void operator[]=(int index, int value) { | 945 void operator[]=(int index, int value) { |
951 if (index < 0 || index >= length) { | 946 if (index < 0 || index >= length) { |
952 throw _newRangeError(index, length); | 947 throw new RangeError.index(index, this, "index"); |
953 } | 948 } |
954 _setInt8(index, _toInt8(value)); | 949 _setInt8(index, _toInt8(value)); |
955 } | 950 } |
956 | 951 |
957 | 952 |
958 // Method(s) implementing TypedData interface. | 953 // Method(s) implementing TypedData interface. |
959 | 954 |
960 int get elementSizeInBytes { | 955 int get elementSizeInBytes { |
961 return Int8List.BYTES_PER_ELEMENT; | 956 return Int8List.BYTES_PER_ELEMENT; |
962 } | 957 } |
(...skipping 13 matching lines...) Expand all Loading... |
976 // Factory constructors. | 971 // Factory constructors. |
977 | 972 |
978 factory _Uint8Array(int length) { | 973 factory _Uint8Array(int length) { |
979 return _new(length); | 974 return _new(length); |
980 } | 975 } |
981 | 976 |
982 | 977 |
983 // Methods implementing List interface. | 978 // Methods implementing List interface. |
984 int operator[](int index) { | 979 int operator[](int index) { |
985 if (index < 0 || index >= length) { | 980 if (index < 0 || index >= length) { |
986 throw _newRangeError(index, length); | 981 throw new RangeError.index(index, this, "index"); |
987 } | 982 } |
988 return _getUint8(index); | 983 return _getUint8(index); |
989 } | 984 } |
990 | 985 |
991 void operator[]=(int index, int value) { | 986 void operator[]=(int index, int value) { |
992 if (index < 0 || index >= length) { | 987 if (index < 0 || index >= length) { |
993 throw _newRangeError(index, length); | 988 throw new RangeError.index(index, this, "index"); |
994 } | 989 } |
995 _setUint8(index, _toUint8(value)); | 990 _setUint8(index, _toUint8(value)); |
996 } | 991 } |
997 | 992 |
998 | 993 |
999 // Methods implementing TypedData interface. | 994 // Methods implementing TypedData interface. |
1000 int get elementSizeInBytes { | 995 int get elementSizeInBytes { |
1001 return Uint8List.BYTES_PER_ELEMENT; | 996 return Uint8List.BYTES_PER_ELEMENT; |
1002 } | 997 } |
1003 | 998 |
(...skipping 12 matching lines...) Expand all Loading... |
1016 // Factory constructors. | 1011 // Factory constructors. |
1017 | 1012 |
1018 factory _Uint8ClampedArray(int length) { | 1013 factory _Uint8ClampedArray(int length) { |
1019 return _new(length); | 1014 return _new(length); |
1020 } | 1015 } |
1021 | 1016 |
1022 // Methods implementing List interface. | 1017 // Methods implementing List interface. |
1023 | 1018 |
1024 int operator[](int index) { | 1019 int operator[](int index) { |
1025 if (index < 0 || index >= length) { | 1020 if (index < 0 || index >= length) { |
1026 throw _newRangeError(index, length); | 1021 throw new RangeError.index(index, this, "index"); |
1027 } | 1022 } |
1028 return _getUint8(index); | 1023 return _getUint8(index); |
1029 } | 1024 } |
1030 | 1025 |
1031 void operator[]=(int index, int value) { | 1026 void operator[]=(int index, int value) { |
1032 if (index < 0 || index >= length) { | 1027 if (index < 0 || index >= length) { |
1033 throw _newRangeError(index, length); | 1028 throw new RangeError.index(index, this, "index"); |
1034 } | 1029 } |
1035 _setUint8(index, _toClampedUint8(value)); | 1030 _setUint8(index, _toClampedUint8(value)); |
1036 } | 1031 } |
1037 | 1032 |
1038 | 1033 |
1039 // Methods implementing TypedData interface. | 1034 // Methods implementing TypedData interface. |
1040 int get elementSizeInBytes { | 1035 int get elementSizeInBytes { |
1041 return Uint8List.BYTES_PER_ELEMENT; | 1036 return Uint8List.BYTES_PER_ELEMENT; |
1042 } | 1037 } |
1043 | 1038 |
(...skipping 14 matching lines...) Expand all Loading... |
1058 | 1053 |
1059 factory _Int16Array(int length) { | 1054 factory _Int16Array(int length) { |
1060 return _new(length); | 1055 return _new(length); |
1061 } | 1056 } |
1062 | 1057 |
1063 | 1058 |
1064 // Method(s) implementing List interface. | 1059 // Method(s) implementing List interface. |
1065 | 1060 |
1066 int operator[](int index) { | 1061 int operator[](int index) { |
1067 if (index < 0 || index >= length) { | 1062 if (index < 0 || index >= length) { |
1068 throw _newRangeError(index, length); | 1063 throw new RangeError.index(index, this, "index"); |
1069 } | 1064 } |
1070 return _getIndexedInt16(index); | 1065 return _getIndexedInt16(index); |
1071 } | 1066 } |
1072 | 1067 |
1073 void operator[]=(int index, int value) { | 1068 void operator[]=(int index, int value) { |
1074 if (index < 0 || index >= length) { | 1069 if (index < 0 || index >= length) { |
1075 throw _newRangeError(index, length); | 1070 throw new RangeError.index(index, this, "index"); |
1076 } | 1071 } |
1077 _setIndexedInt16(index, _toInt16(value)); | 1072 _setIndexedInt16(index, _toInt16(value)); |
1078 } | 1073 } |
1079 | 1074 |
1080 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { | 1075 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { |
1081 if (ClassID.getID(iterable) == CodeUnits.cid) { | 1076 if (ClassID.getID(iterable) == CodeUnits.cid) { |
1082 end = RangeError.checkValidRange(start, end, this.length); | 1077 end = RangeError.checkValidRange(start, end, this.length); |
1083 int length = end - start; | 1078 int length = end - start; |
1084 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT; | 1079 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT; |
1085 _setCodeUnits(iterable, byteStart, length, skipCount); | 1080 _setCodeUnits(iterable, byteStart, length, skipCount); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 | 1113 |
1119 factory _Uint16Array(int length) { | 1114 factory _Uint16Array(int length) { |
1120 return _new(length); | 1115 return _new(length); |
1121 } | 1116 } |
1122 | 1117 |
1123 | 1118 |
1124 // Method(s) implementing the List interface. | 1119 // Method(s) implementing the List interface. |
1125 | 1120 |
1126 int operator[](int index) { | 1121 int operator[](int index) { |
1127 if (index < 0 || index >= length) { | 1122 if (index < 0 || index >= length) { |
1128 throw _newRangeError(index, length); | 1123 throw new RangeError.index(index, this, "index"); |
1129 } | 1124 } |
1130 return _getIndexedUint16(index); | 1125 return _getIndexedUint16(index); |
1131 } | 1126 } |
1132 | 1127 |
1133 void operator[]=(int index, int value) { | 1128 void operator[]=(int index, int value) { |
1134 if (index < 0 || index >= length) { | 1129 if (index < 0 || index >= length) { |
1135 throw _newRangeError(index, length); | 1130 throw new RangeError.index(index, this, "index"); |
1136 } | 1131 } |
1137 _setIndexedUint16(index, _toUint16(value)); | 1132 _setIndexedUint16(index, _toUint16(value)); |
1138 } | 1133 } |
1139 | 1134 |
1140 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { | 1135 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { |
1141 if (ClassID.getID(iterable) == CodeUnits.cid) { | 1136 if (ClassID.getID(iterable) == CodeUnits.cid) { |
1142 end = RangeError.checkValidRange(start, end, this.length); | 1137 end = RangeError.checkValidRange(start, end, this.length); |
1143 int length = end - start; | 1138 int length = end - start; |
1144 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT; | 1139 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT; |
1145 _setCodeUnits(iterable, byteStart, length, skipCount); | 1140 _setCodeUnits(iterable, byteStart, length, skipCount); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 | 1173 |
1179 factory _Int32Array(int length) { | 1174 factory _Int32Array(int length) { |
1180 return _new(length); | 1175 return _new(length); |
1181 } | 1176 } |
1182 | 1177 |
1183 | 1178 |
1184 // Method(s) implementing the List interface. | 1179 // Method(s) implementing the List interface. |
1185 | 1180 |
1186 int operator[](int index) { | 1181 int operator[](int index) { |
1187 if (index < 0 || index >= length) { | 1182 if (index < 0 || index >= length) { |
1188 throw _newRangeError(index, length); | 1183 throw new RangeError.index(index, this, "index"); |
1189 } | 1184 } |
1190 return _getIndexedInt32(index); | 1185 return _getIndexedInt32(index); |
1191 } | 1186 } |
1192 | 1187 |
1193 void operator[]=(int index, int value) { | 1188 void operator[]=(int index, int value) { |
1194 if (index < 0 || index >= length) { | 1189 if (index < 0 || index >= length) { |
1195 throw _newRangeError(index, length); | 1190 throw new RangeError.index(index, this, "index"); |
1196 } | 1191 } |
1197 _setIndexedInt32(index, _toInt32(value)); | 1192 _setIndexedInt32(index, _toInt32(value)); |
1198 } | 1193 } |
1199 | 1194 |
1200 | 1195 |
1201 // Method(s) implementing TypedData interface. | 1196 // Method(s) implementing TypedData interface. |
1202 | 1197 |
1203 int get elementSizeInBytes { | 1198 int get elementSizeInBytes { |
1204 return Int32List.BYTES_PER_ELEMENT; | 1199 return Int32List.BYTES_PER_ELEMENT; |
1205 } | 1200 } |
(...skipping 22 matching lines...) Expand all Loading... |
1228 | 1223 |
1229 factory _Uint32Array(int length) { | 1224 factory _Uint32Array(int length) { |
1230 return _new(length); | 1225 return _new(length); |
1231 } | 1226 } |
1232 | 1227 |
1233 | 1228 |
1234 // Method(s) implementing the List interface. | 1229 // Method(s) implementing the List interface. |
1235 | 1230 |
1236 int operator[](int index) { | 1231 int operator[](int index) { |
1237 if (index < 0 || index >= length) { | 1232 if (index < 0 || index >= length) { |
1238 throw _newRangeError(index, length); | 1233 throw new RangeError.index(index, this, "index"); |
1239 } | 1234 } |
1240 return _getIndexedUint32(index); | 1235 return _getIndexedUint32(index); |
1241 } | 1236 } |
1242 | 1237 |
1243 void operator[]=(int index, int value) { | 1238 void operator[]=(int index, int value) { |
1244 if (index < 0 || index >= length) { | 1239 if (index < 0 || index >= length) { |
1245 throw _newRangeError(index, length); | 1240 throw new RangeError.index(index, this, "index"); |
1246 } | 1241 } |
1247 _setIndexedUint32(index, _toUint32(value)); | 1242 _setIndexedUint32(index, _toUint32(value)); |
1248 } | 1243 } |
1249 | 1244 |
1250 | 1245 |
1251 // Method(s) implementing the TypedData interface. | 1246 // Method(s) implementing the TypedData interface. |
1252 | 1247 |
1253 int get elementSizeInBytes { | 1248 int get elementSizeInBytes { |
1254 return Uint32List.BYTES_PER_ELEMENT; | 1249 return Uint32List.BYTES_PER_ELEMENT; |
1255 } | 1250 } |
(...skipping 22 matching lines...) Expand all Loading... |
1278 | 1273 |
1279 factory _Int64Array(int length) { | 1274 factory _Int64Array(int length) { |
1280 return _new(length); | 1275 return _new(length); |
1281 } | 1276 } |
1282 | 1277 |
1283 | 1278 |
1284 // Method(s) implementing the List interface. | 1279 // Method(s) implementing the List interface. |
1285 | 1280 |
1286 int operator[](int index) { | 1281 int operator[](int index) { |
1287 if (index < 0 || index >= length) { | 1282 if (index < 0 || index >= length) { |
1288 throw _newRangeError(index, length); | 1283 throw new RangeError.index(index, this, "index"); |
1289 } | 1284 } |
1290 return _getIndexedInt64(index); | 1285 return _getIndexedInt64(index); |
1291 } | 1286 } |
1292 | 1287 |
1293 void operator[]=(int index, int value) { | 1288 void operator[]=(int index, int value) { |
1294 if (index < 0 || index >= length) { | 1289 if (index < 0 || index >= length) { |
1295 throw _newRangeError(index, length); | 1290 throw new RangeError.index(index, this, "index"); |
1296 } | 1291 } |
1297 _setIndexedInt64(index, _toInt64(value)); | 1292 _setIndexedInt64(index, _toInt64(value)); |
1298 } | 1293 } |
1299 | 1294 |
1300 | 1295 |
1301 // Method(s) implementing the TypedData interface. | 1296 // Method(s) implementing the TypedData interface. |
1302 | 1297 |
1303 int get elementSizeInBytes { | 1298 int get elementSizeInBytes { |
1304 return Int64List.BYTES_PER_ELEMENT; | 1299 return Int64List.BYTES_PER_ELEMENT; |
1305 } | 1300 } |
(...skipping 22 matching lines...) Expand all Loading... |
1328 | 1323 |
1329 factory _Uint64Array(int length) { | 1324 factory _Uint64Array(int length) { |
1330 return _new(length); | 1325 return _new(length); |
1331 } | 1326 } |
1332 | 1327 |
1333 | 1328 |
1334 // Method(s) implementing the List interface. | 1329 // Method(s) implementing the List interface. |
1335 | 1330 |
1336 int operator[](int index) { | 1331 int operator[](int index) { |
1337 if (index < 0 || index >= length) { | 1332 if (index < 0 || index >= length) { |
1338 throw _newRangeError(index, length); | 1333 throw new RangeError.index(index, this, "index"); |
1339 } | 1334 } |
1340 return _getIndexedUint64(index); | 1335 return _getIndexedUint64(index); |
1341 } | 1336 } |
1342 | 1337 |
1343 void operator[]=(int index, int value) { | 1338 void operator[]=(int index, int value) { |
1344 if (index < 0 || index >= length) { | 1339 if (index < 0 || index >= length) { |
1345 throw _newRangeError(index, length); | 1340 throw new RangeError.index(index, this, "index"); |
1346 } | 1341 } |
1347 _setIndexedUint64(index, _toUint64(value)); | 1342 _setIndexedUint64(index, _toUint64(value)); |
1348 } | 1343 } |
1349 | 1344 |
1350 | 1345 |
1351 // Method(s) implementing the TypedData interface. | 1346 // Method(s) implementing the TypedData interface. |
1352 | 1347 |
1353 int get elementSizeInBytes { | 1348 int get elementSizeInBytes { |
1354 return Uint64List.BYTES_PER_ELEMENT; | 1349 return Uint64List.BYTES_PER_ELEMENT; |
1355 } | 1350 } |
(...skipping 22 matching lines...) Expand all Loading... |
1378 | 1373 |
1379 factory _Float32Array(int length) { | 1374 factory _Float32Array(int length) { |
1380 return _new(length); | 1375 return _new(length); |
1381 } | 1376 } |
1382 | 1377 |
1383 | 1378 |
1384 // Method(s) implementing the List interface. | 1379 // Method(s) implementing the List interface. |
1385 | 1380 |
1386 double operator[](int index) { | 1381 double operator[](int index) { |
1387 if (index < 0 || index >= length) { | 1382 if (index < 0 || index >= length) { |
1388 throw _newRangeError(index, length); | 1383 throw new RangeError.index(index, this, "index"); |
1389 } | 1384 } |
1390 return _getIndexedFloat32(index); | 1385 return _getIndexedFloat32(index); |
1391 } | 1386 } |
1392 | 1387 |
1393 void operator[]=(int index, double value) { | 1388 void operator[]=(int index, double value) { |
1394 if (index < 0 || index >= length) { | 1389 if (index < 0 || index >= length) { |
1395 throw _newRangeError(index, length); | 1390 throw new RangeError.index(index, this, "index"); |
1396 } | 1391 } |
1397 _setIndexedFloat32(index, value); | 1392 _setIndexedFloat32(index, value); |
1398 } | 1393 } |
1399 | 1394 |
1400 | 1395 |
1401 // Method(s) implementing the TypedData interface. | 1396 // Method(s) implementing the TypedData interface. |
1402 | 1397 |
1403 int get elementSizeInBytes { | 1398 int get elementSizeInBytes { |
1404 return Float32List.BYTES_PER_ELEMENT; | 1399 return Float32List.BYTES_PER_ELEMENT; |
1405 } | 1400 } |
(...skipping 22 matching lines...) Expand all Loading... |
1428 | 1423 |
1429 factory _Float64Array(int length) { | 1424 factory _Float64Array(int length) { |
1430 return _new(length); | 1425 return _new(length); |
1431 } | 1426 } |
1432 | 1427 |
1433 | 1428 |
1434 // Method(s) implementing the List interface. | 1429 // Method(s) implementing the List interface. |
1435 | 1430 |
1436 double operator[](int index) { | 1431 double operator[](int index) { |
1437 if (index < 0 || index >= length) { | 1432 if (index < 0 || index >= length) { |
1438 throw _newRangeError(index, length); | 1433 throw new RangeError.index(index, this, "index"); |
1439 } | 1434 } |
1440 return _getIndexedFloat64(index); | 1435 return _getIndexedFloat64(index); |
1441 } | 1436 } |
1442 | 1437 |
1443 void operator[]=(int index, double value) { | 1438 void operator[]=(int index, double value) { |
1444 if (index < 0 || index >= length) { | 1439 if (index < 0 || index >= length) { |
1445 throw _newRangeError(index, length); | 1440 throw new RangeError.index(index, this, "index"); |
1446 } | 1441 } |
1447 _setIndexedFloat64(index, value); | 1442 _setIndexedFloat64(index, value); |
1448 } | 1443 } |
1449 | 1444 |
1450 | 1445 |
1451 // Method(s) implementing the TypedData interface. | 1446 // Method(s) implementing the TypedData interface. |
1452 | 1447 |
1453 int get elementSizeInBytes { | 1448 int get elementSizeInBytes { |
1454 return Float64List.BYTES_PER_ELEMENT; | 1449 return Float64List.BYTES_PER_ELEMENT; |
1455 } | 1450 } |
(...skipping 20 matching lines...) Expand all Loading... |
1476 class _Float32x4Array extends _TypedList with _Float32x4ListMixin implements Flo
at32x4List { | 1471 class _Float32x4Array extends _TypedList with _Float32x4ListMixin implements Flo
at32x4List { |
1477 // Factory constructors. | 1472 // Factory constructors. |
1478 | 1473 |
1479 factory _Float32x4Array(int length) { | 1474 factory _Float32x4Array(int length) { |
1480 return _new(length); | 1475 return _new(length); |
1481 } | 1476 } |
1482 | 1477 |
1483 | 1478 |
1484 Float32x4 operator[](int index) { | 1479 Float32x4 operator[](int index) { |
1485 if (index < 0 || index >= length) { | 1480 if (index < 0 || index >= length) { |
1486 throw _newRangeError(index, length); | 1481 throw new RangeError.index(index, this, "index"); |
1487 } | 1482 } |
1488 return _getIndexedFloat32x4(index); | 1483 return _getIndexedFloat32x4(index); |
1489 } | 1484 } |
1490 | 1485 |
1491 void operator[]=(int index, Float32x4 value) { | 1486 void operator[]=(int index, Float32x4 value) { |
1492 if (index < 0 || index >= length) { | 1487 if (index < 0 || index >= length) { |
1493 throw _newRangeError(index, length); | 1488 throw new RangeError.index(index, this, "index"); |
1494 } | 1489 } |
1495 _setIndexedFloat32x4(index, value); | 1490 _setIndexedFloat32x4(index, value); |
1496 } | 1491 } |
1497 | 1492 |
1498 | 1493 |
1499 // Method(s) implementing the TypedData interface. | 1494 // Method(s) implementing the TypedData interface. |
1500 | 1495 |
1501 int get elementSizeInBytes { | 1496 int get elementSizeInBytes { |
1502 return Float32x4List.BYTES_PER_ELEMENT; | 1497 return Float32x4List.BYTES_PER_ELEMENT; |
1503 } | 1498 } |
(...skipping 20 matching lines...) Expand all Loading... |
1524 class _Int32x4Array extends _TypedList with _Int32x4ListMixin implements Int32x4
List { | 1519 class _Int32x4Array extends _TypedList with _Int32x4ListMixin implements Int32x4
List { |
1525 // Factory constructors. | 1520 // Factory constructors. |
1526 | 1521 |
1527 factory _Int32x4Array(int length) { | 1522 factory _Int32x4Array(int length) { |
1528 return _new(length); | 1523 return _new(length); |
1529 } | 1524 } |
1530 | 1525 |
1531 | 1526 |
1532 Int32x4 operator[](int index) { | 1527 Int32x4 operator[](int index) { |
1533 if (index < 0 || index >= length) { | 1528 if (index < 0 || index >= length) { |
1534 throw _newRangeError(index, length); | 1529 throw new RangeError.index(index, this, "index"); |
1535 } | 1530 } |
1536 return _getIndexedInt32x4(index); | 1531 return _getIndexedInt32x4(index); |
1537 } | 1532 } |
1538 | 1533 |
1539 void operator[]=(int index, Int32x4 value) { | 1534 void operator[]=(int index, Int32x4 value) { |
1540 if (index < 0 || index >= length) { | 1535 if (index < 0 || index >= length) { |
1541 throw _newRangeError(index, length); | 1536 throw new RangeError.index(index, this, "index"); |
1542 } | 1537 } |
1543 _setIndexedInt32x4(index, value); | 1538 _setIndexedInt32x4(index, value); |
1544 } | 1539 } |
1545 | 1540 |
1546 | 1541 |
1547 // Method(s) implementing the TypedData interface. | 1542 // Method(s) implementing the TypedData interface. |
1548 | 1543 |
1549 int get elementSizeInBytes { | 1544 int get elementSizeInBytes { |
1550 return Int32x4List.BYTES_PER_ELEMENT; | 1545 return Int32x4List.BYTES_PER_ELEMENT; |
1551 } | 1546 } |
(...skipping 20 matching lines...) Expand all Loading... |
1572 class _Float64x2Array extends _TypedList with _Float64x2ListMixin implements Flo
at64x2List { | 1567 class _Float64x2Array extends _TypedList with _Float64x2ListMixin implements Flo
at64x2List { |
1573 // Factory constructors. | 1568 // Factory constructors. |
1574 | 1569 |
1575 factory _Float64x2Array(int length) { | 1570 factory _Float64x2Array(int length) { |
1576 return _new(length); | 1571 return _new(length); |
1577 } | 1572 } |
1578 | 1573 |
1579 | 1574 |
1580 Float64x2 operator[](int index) { | 1575 Float64x2 operator[](int index) { |
1581 if (index < 0 || index >= length) { | 1576 if (index < 0 || index >= length) { |
1582 throw _newRangeError(index, length); | 1577 throw new RangeError.index(index, this, "index"); |
1583 } | 1578 } |
1584 return _getIndexedFloat64x2(index); | 1579 return _getIndexedFloat64x2(index); |
1585 } | 1580 } |
1586 | 1581 |
1587 void operator[]=(int index, Float64x2 value) { | 1582 void operator[]=(int index, Float64x2 value) { |
1588 if (index < 0 || index >= length) { | 1583 if (index < 0 || index >= length) { |
1589 throw _newRangeError(index, length); | 1584 throw new RangeError.index(index, this, "index"); |
1590 } | 1585 } |
1591 _setIndexedFloat64x2(index, value); | 1586 _setIndexedFloat64x2(index, value); |
1592 } | 1587 } |
1593 | 1588 |
1594 | 1589 |
1595 // Method(s) implementing the TypedData interface. | 1590 // Method(s) implementing the TypedData interface. |
1596 | 1591 |
1597 int get elementSizeInBytes { | 1592 int get elementSizeInBytes { |
1598 return Float64x2List.BYTES_PER_ELEMENT; | 1593 return Float64x2List.BYTES_PER_ELEMENT; |
1599 } | 1594 } |
(...skipping 21 matching lines...) Expand all Loading... |
1621 // Factory constructors. | 1616 // Factory constructors. |
1622 | 1617 |
1623 factory _ExternalInt8Array(int length) { | 1618 factory _ExternalInt8Array(int length) { |
1624 return _new(length); | 1619 return _new(length); |
1625 } | 1620 } |
1626 | 1621 |
1627 | 1622 |
1628 // Method(s) implementing the List interface. | 1623 // Method(s) implementing the List interface. |
1629 int operator[](int index) { | 1624 int operator[](int index) { |
1630 if (index < 0 || index >= length) { | 1625 if (index < 0 || index >= length) { |
1631 throw _newRangeError(index, length); | 1626 throw new RangeError.index(index, this, "index"); |
1632 } | 1627 } |
1633 return _getInt8(index); | 1628 return _getInt8(index); |
1634 } | 1629 } |
1635 | 1630 |
1636 void operator[]=(int index, int value) { | 1631 void operator[]=(int index, int value) { |
1637 if (index < 0 || index >= length) { | 1632 if (index < 0 || index >= length) { |
1638 throw _newRangeError(index, length); | 1633 throw new RangeError.index(index, this, "index"); |
1639 } | 1634 } |
1640 _setInt8(index, value); | 1635 _setInt8(index, value); |
1641 } | 1636 } |
1642 | 1637 |
1643 | 1638 |
1644 // Method(s) implementing the TypedData interface. | 1639 // Method(s) implementing the TypedData interface. |
1645 | 1640 |
1646 int get elementSizeInBytes { | 1641 int get elementSizeInBytes { |
1647 return Int8List.BYTES_PER_ELEMENT; | 1642 return Int8List.BYTES_PER_ELEMENT; |
1648 } | 1643 } |
(...skipping 15 matching lines...) Expand all Loading... |
1664 | 1659 |
1665 factory _ExternalUint8Array(int length) { | 1660 factory _ExternalUint8Array(int length) { |
1666 return _new(length); | 1661 return _new(length); |
1667 } | 1662 } |
1668 | 1663 |
1669 | 1664 |
1670 // Method(s) implementing the List interface. | 1665 // Method(s) implementing the List interface. |
1671 | 1666 |
1672 int operator[](int index) { | 1667 int operator[](int index) { |
1673 if (index < 0 || index >= length) { | 1668 if (index < 0 || index >= length) { |
1674 throw _newRangeError(index, length); | 1669 throw new RangeError.index(index, this, "index"); |
1675 } | 1670 } |
1676 return _getUint8(index); | 1671 return _getUint8(index); |
1677 } | 1672 } |
1678 | 1673 |
1679 void operator[]=(int index, int value) { | 1674 void operator[]=(int index, int value) { |
1680 if (index < 0 || index >= length) { | 1675 if (index < 0 || index >= length) { |
1681 throw _newRangeError(index, length); | 1676 throw new RangeError.index(index, this, "index"); |
1682 } | 1677 } |
1683 _setUint8(index, _toUint8(value)); | 1678 _setUint8(index, _toUint8(value)); |
1684 } | 1679 } |
1685 | 1680 |
1686 | 1681 |
1687 // Method(s) implementing the TypedData interface. | 1682 // Method(s) implementing the TypedData interface. |
1688 | 1683 |
1689 int get elementSizeInBytes { | 1684 int get elementSizeInBytes { |
1690 return Uint8List.BYTES_PER_ELEMENT; | 1685 return Uint8List.BYTES_PER_ELEMENT; |
1691 } | 1686 } |
(...skipping 14 matching lines...) Expand all Loading... |
1706 // Factory constructors. | 1701 // Factory constructors. |
1707 | 1702 |
1708 factory _ExternalUint8ClampedArray(int length) { | 1703 factory _ExternalUint8ClampedArray(int length) { |
1709 return _new(length); | 1704 return _new(length); |
1710 } | 1705 } |
1711 | 1706 |
1712 // Method(s) implementing the List interface. | 1707 // Method(s) implementing the List interface. |
1713 | 1708 |
1714 int operator[](int index) { | 1709 int operator[](int index) { |
1715 if (index < 0 || index >= length) { | 1710 if (index < 0 || index >= length) { |
1716 throw _newRangeError(index, length); | 1711 throw new RangeError.index(index, this, "index"); |
1717 } | 1712 } |
1718 return _getUint8(index); | 1713 return _getUint8(index); |
1719 } | 1714 } |
1720 | 1715 |
1721 void operator[]=(int index, int value) { | 1716 void operator[]=(int index, int value) { |
1722 if (index < 0 || index >= length) { | 1717 if (index < 0 || index >= length) { |
1723 throw _newRangeError(index, length); | 1718 throw new RangeError.index(index, this, "index"); |
1724 } | 1719 } |
1725 _setUint8(index, _toClampedUint8(value)); | 1720 _setUint8(index, _toClampedUint8(value)); |
1726 } | 1721 } |
1727 | 1722 |
1728 | 1723 |
1729 // Method(s) implementing the TypedData interface. | 1724 // Method(s) implementing the TypedData interface. |
1730 | 1725 |
1731 int get elementSizeInBytes { | 1726 int get elementSizeInBytes { |
1732 return Uint8List.BYTES_PER_ELEMENT; | 1727 return Uint8List.BYTES_PER_ELEMENT; |
1733 } | 1728 } |
(...skipping 15 matching lines...) Expand all Loading... |
1749 | 1744 |
1750 factory _ExternalInt16Array(int length) { | 1745 factory _ExternalInt16Array(int length) { |
1751 return _new(length); | 1746 return _new(length); |
1752 } | 1747 } |
1753 | 1748 |
1754 | 1749 |
1755 // Method(s) implementing the List interface. | 1750 // Method(s) implementing the List interface. |
1756 | 1751 |
1757 int operator[](int index) { | 1752 int operator[](int index) { |
1758 if (index < 0 || index >= length) { | 1753 if (index < 0 || index >= length) { |
1759 throw _newRangeError(index, length); | 1754 throw new RangeError.index(index, this, "index"); |
1760 } | 1755 } |
1761 return _getIndexedInt16(index); | 1756 return _getIndexedInt16(index); |
1762 } | 1757 } |
1763 | 1758 |
1764 void operator[]=(int index, int value) { | 1759 void operator[]=(int index, int value) { |
1765 if (index < 0 || index >= length) { | 1760 if (index < 0 || index >= length) { |
1766 throw _newRangeError(index, length); | 1761 throw new RangeError.index(index, this, "index"); |
1767 } | 1762 } |
1768 _setIndexedInt16(index, _toInt16(value)); | 1763 _setIndexedInt16(index, _toInt16(value)); |
1769 } | 1764 } |
1770 | 1765 |
1771 | 1766 |
1772 // Method(s) implementing the TypedData interface. | 1767 // Method(s) implementing the TypedData interface. |
1773 | 1768 |
1774 int get elementSizeInBytes { | 1769 int get elementSizeInBytes { |
1775 return Int16List.BYTES_PER_ELEMENT; | 1770 return Int16List.BYTES_PER_ELEMENT; |
1776 } | 1771 } |
(...skipping 23 matching lines...) Expand all Loading... |
1800 | 1795 |
1801 factory _ExternalUint16Array(int length) { | 1796 factory _ExternalUint16Array(int length) { |
1802 return _new(length); | 1797 return _new(length); |
1803 } | 1798 } |
1804 | 1799 |
1805 | 1800 |
1806 // Method(s) implementing the List interface. | 1801 // Method(s) implementing the List interface. |
1807 | 1802 |
1808 int operator[](int index) { | 1803 int operator[](int index) { |
1809 if (index < 0 || index >= length) { | 1804 if (index < 0 || index >= length) { |
1810 throw _newRangeError(index, length); | 1805 throw new RangeError.index(index, this, "index"); |
1811 } | 1806 } |
1812 return _getIndexedUint16(index); | 1807 return _getIndexedUint16(index); |
1813 } | 1808 } |
1814 | 1809 |
1815 void operator[]=(int index, int value) { | 1810 void operator[]=(int index, int value) { |
1816 if (index < 0 || index >= length) { | 1811 if (index < 0 || index >= length) { |
1817 throw _newRangeError(index, length); | 1812 throw new RangeError.index(index, this, "index"); |
1818 } | 1813 } |
1819 _setIndexedUint16(index, _toUint16(value)); | 1814 _setIndexedUint16(index, _toUint16(value)); |
1820 } | 1815 } |
1821 | 1816 |
1822 | 1817 |
1823 // Method(s) implementing the TypedData interface. | 1818 // Method(s) implementing the TypedData interface. |
1824 | 1819 |
1825 int get elementSizeInBytes { | 1820 int get elementSizeInBytes { |
1826 return Uint16List.BYTES_PER_ELEMENT; | 1821 return Uint16List.BYTES_PER_ELEMENT; |
1827 } | 1822 } |
(...skipping 23 matching lines...) Expand all Loading... |
1851 | 1846 |
1852 factory _ExternalInt32Array(int length) { | 1847 factory _ExternalInt32Array(int length) { |
1853 return _new(length); | 1848 return _new(length); |
1854 } | 1849 } |
1855 | 1850 |
1856 | 1851 |
1857 // Method(s) implementing the List interface. | 1852 // Method(s) implementing the List interface. |
1858 | 1853 |
1859 int operator[](int index) { | 1854 int operator[](int index) { |
1860 if (index < 0 || index >= length) { | 1855 if (index < 0 || index >= length) { |
1861 throw _newRangeError(index, length); | 1856 throw new RangeError.index(index, this, "index"); |
1862 } | 1857 } |
1863 return _getIndexedInt32(index); | 1858 return _getIndexedInt32(index); |
1864 } | 1859 } |
1865 | 1860 |
1866 void operator[]=(int index, int value) { | 1861 void operator[]=(int index, int value) { |
1867 if (index < 0 || index >= length) { | 1862 if (index < 0 || index >= length) { |
1868 throw _newRangeError(index, length); | 1863 throw new RangeError.index(index, this, "index"); |
1869 } | 1864 } |
1870 _setIndexedInt32(index, _toInt32(value)); | 1865 _setIndexedInt32(index, _toInt32(value)); |
1871 } | 1866 } |
1872 | 1867 |
1873 | 1868 |
1874 // Method(s) implementing the TypedData interface. | 1869 // Method(s) implementing the TypedData interface. |
1875 | 1870 |
1876 int get elementSizeInBytes { | 1871 int get elementSizeInBytes { |
1877 return Int32List.BYTES_PER_ELEMENT; | 1872 return Int32List.BYTES_PER_ELEMENT; |
1878 } | 1873 } |
(...skipping 23 matching lines...) Expand all Loading... |
1902 | 1897 |
1903 factory _ExternalUint32Array(int length) { | 1898 factory _ExternalUint32Array(int length) { |
1904 return _new(length); | 1899 return _new(length); |
1905 } | 1900 } |
1906 | 1901 |
1907 | 1902 |
1908 // Method(s) implementing the List interface. | 1903 // Method(s) implementing the List interface. |
1909 | 1904 |
1910 int operator[](int index) { | 1905 int operator[](int index) { |
1911 if (index < 0 || index >= length) { | 1906 if (index < 0 || index >= length) { |
1912 throw _newRangeError(index, length); | 1907 throw new RangeError.index(index, this, "index"); |
1913 } | 1908 } |
1914 return _getIndexedUint32(index); | 1909 return _getIndexedUint32(index); |
1915 } | 1910 } |
1916 | 1911 |
1917 void operator[]=(int index, int value) { | 1912 void operator[]=(int index, int value) { |
1918 if (index < 0 || index >= length) { | 1913 if (index < 0 || index >= length) { |
1919 throw _newRangeError(index, length); | 1914 throw new RangeError.index(index, this, "index"); |
1920 } | 1915 } |
1921 _setIndexedUint32(index, _toUint32(value)); | 1916 _setIndexedUint32(index, _toUint32(value)); |
1922 } | 1917 } |
1923 | 1918 |
1924 | 1919 |
1925 // Method(s) implementing the TypedData interface. | 1920 // Method(s) implementing the TypedData interface. |
1926 | 1921 |
1927 int get elementSizeInBytes { | 1922 int get elementSizeInBytes { |
1928 return Uint32List.BYTES_PER_ELEMENT; | 1923 return Uint32List.BYTES_PER_ELEMENT; |
1929 } | 1924 } |
(...skipping 23 matching lines...) Expand all Loading... |
1953 | 1948 |
1954 factory _ExternalInt64Array(int length) { | 1949 factory _ExternalInt64Array(int length) { |
1955 return _new(length); | 1950 return _new(length); |
1956 } | 1951 } |
1957 | 1952 |
1958 | 1953 |
1959 // Method(s) implementing the List interface. | 1954 // Method(s) implementing the List interface. |
1960 | 1955 |
1961 int operator[](int index) { | 1956 int operator[](int index) { |
1962 if (index < 0 || index >= length) { | 1957 if (index < 0 || index >= length) { |
1963 throw _newRangeError(index, length); | 1958 throw new RangeError.index(index, this, "index"); |
1964 } | 1959 } |
1965 return _getIndexedInt64(index); | 1960 return _getIndexedInt64(index); |
1966 } | 1961 } |
1967 | 1962 |
1968 void operator[]=(int index, int value) { | 1963 void operator[]=(int index, int value) { |
1969 if (index < 0 || index >= length) { | 1964 if (index < 0 || index >= length) { |
1970 throw _newRangeError(index, length); | 1965 throw new RangeError.index(index, this, "index"); |
1971 } | 1966 } |
1972 _setIndexedInt64(index, _toInt64(value)); | 1967 _setIndexedInt64(index, _toInt64(value)); |
1973 } | 1968 } |
1974 | 1969 |
1975 | 1970 |
1976 // Method(s) implementing the TypedData interface. | 1971 // Method(s) implementing the TypedData interface. |
1977 | 1972 |
1978 int get elementSizeInBytes { | 1973 int get elementSizeInBytes { |
1979 return Int64List.BYTES_PER_ELEMENT; | 1974 return Int64List.BYTES_PER_ELEMENT; |
1980 } | 1975 } |
(...skipping 23 matching lines...) Expand all Loading... |
2004 | 1999 |
2005 factory _ExternalUint64Array(int length) { | 2000 factory _ExternalUint64Array(int length) { |
2006 return _new(length); | 2001 return _new(length); |
2007 } | 2002 } |
2008 | 2003 |
2009 | 2004 |
2010 // Method(s) implementing the List interface. | 2005 // Method(s) implementing the List interface. |
2011 | 2006 |
2012 int operator[](int index) { | 2007 int operator[](int index) { |
2013 if (index < 0 || index >= length) { | 2008 if (index < 0 || index >= length) { |
2014 throw _newRangeError(index, length); | 2009 throw new RangeError.index(index, this, "index"); |
2015 } | 2010 } |
2016 return _getIndexedUint64(index); | 2011 return _getIndexedUint64(index); |
2017 } | 2012 } |
2018 | 2013 |
2019 void operator[]=(int index, int value) { | 2014 void operator[]=(int index, int value) { |
2020 if (index < 0 || index >= length) { | 2015 if (index < 0 || index >= length) { |
2021 throw _newRangeError(index, length); | 2016 throw new RangeError.index(index, this, "index"); |
2022 } | 2017 } |
2023 _setIndexedUint64(index, _toUint64(value)); | 2018 _setIndexedUint64(index, _toUint64(value)); |
2024 } | 2019 } |
2025 | 2020 |
2026 | 2021 |
2027 // Method(s) implementing the TypedData interface. | 2022 // Method(s) implementing the TypedData interface. |
2028 | 2023 |
2029 int get elementSizeInBytes { | 2024 int get elementSizeInBytes { |
2030 return Uint64List.BYTES_PER_ELEMENT; | 2025 return Uint64List.BYTES_PER_ELEMENT; |
2031 } | 2026 } |
(...skipping 23 matching lines...) Expand all Loading... |
2055 | 2050 |
2056 factory _ExternalFloat32Array(int length) { | 2051 factory _ExternalFloat32Array(int length) { |
2057 return _new(length); | 2052 return _new(length); |
2058 } | 2053 } |
2059 | 2054 |
2060 | 2055 |
2061 // Method(s) implementing the List interface. | 2056 // Method(s) implementing the List interface. |
2062 | 2057 |
2063 double operator[](int index) { | 2058 double operator[](int index) { |
2064 if (index < 0 || index >= length) { | 2059 if (index < 0 || index >= length) { |
2065 throw _newRangeError(index, length); | 2060 throw new RangeError.index(index, this, "index"); |
2066 } | 2061 } |
2067 return _getIndexedFloat32(index); | 2062 return _getIndexedFloat32(index); |
2068 } | 2063 } |
2069 | 2064 |
2070 void operator[]=(int index, double value) { | 2065 void operator[]=(int index, double value) { |
2071 if (index < 0 || index >= length) { | 2066 if (index < 0 || index >= length) { |
2072 throw _newRangeError(index, length); | 2067 throw new RangeError.index(index, this, "index"); |
2073 } | 2068 } |
2074 _setIndexedFloat32(index, value); | 2069 _setIndexedFloat32(index, value); |
2075 } | 2070 } |
2076 | 2071 |
2077 | 2072 |
2078 // Method(s) implementing the TypedData interface. | 2073 // Method(s) implementing the TypedData interface. |
2079 | 2074 |
2080 int get elementSizeInBytes { | 2075 int get elementSizeInBytes { |
2081 return Float32List.BYTES_PER_ELEMENT; | 2076 return Float32List.BYTES_PER_ELEMENT; |
2082 } | 2077 } |
(...skipping 23 matching lines...) Expand all Loading... |
2106 | 2101 |
2107 factory _ExternalFloat64Array(int length) { | 2102 factory _ExternalFloat64Array(int length) { |
2108 return _new(length); | 2103 return _new(length); |
2109 } | 2104 } |
2110 | 2105 |
2111 | 2106 |
2112 // Method(s) implementing the List interface. | 2107 // Method(s) implementing the List interface. |
2113 | 2108 |
2114 double operator[](int index) { | 2109 double operator[](int index) { |
2115 if (index < 0 || index >= length) { | 2110 if (index < 0 || index >= length) { |
2116 throw _newRangeError(index, length); | 2111 throw new RangeError.index(index, this, "index"); |
2117 } | 2112 } |
2118 return _getIndexedFloat64(index); | 2113 return _getIndexedFloat64(index); |
2119 } | 2114 } |
2120 | 2115 |
2121 void operator[]=(int index, double value) { | 2116 void operator[]=(int index, double value) { |
2122 if (index < 0 || index >= length) { | 2117 if (index < 0 || index >= length) { |
2123 throw _newRangeError(index, length); | 2118 throw new RangeError.index(index, this, "index"); |
2124 } | 2119 } |
2125 _setIndexedFloat64(index, value); | 2120 _setIndexedFloat64(index, value); |
2126 } | 2121 } |
2127 | 2122 |
2128 | 2123 |
2129 // Method(s) implementing the TypedData interface. | 2124 // Method(s) implementing the TypedData interface. |
2130 | 2125 |
2131 int get elementSizeInBytes { | 2126 int get elementSizeInBytes { |
2132 return Float64List.BYTES_PER_ELEMENT; | 2127 return Float64List.BYTES_PER_ELEMENT; |
2133 } | 2128 } |
(...skipping 23 matching lines...) Expand all Loading... |
2157 | 2152 |
2158 factory _ExternalFloat32x4Array(int length) { | 2153 factory _ExternalFloat32x4Array(int length) { |
2159 return _new(length); | 2154 return _new(length); |
2160 } | 2155 } |
2161 | 2156 |
2162 | 2157 |
2163 // Method(s) implementing the List interface. | 2158 // Method(s) implementing the List interface. |
2164 | 2159 |
2165 Float32x4 operator[](int index) { | 2160 Float32x4 operator[](int index) { |
2166 if (index < 0 || index >= length) { | 2161 if (index < 0 || index >= length) { |
2167 throw _newRangeError(index, length); | 2162 throw new RangeError.index(index, this, "index"); |
2168 } | 2163 } |
2169 return _getIndexedFloat32x4(index); | 2164 return _getIndexedFloat32x4(index); |
2170 } | 2165 } |
2171 | 2166 |
2172 void operator[]=(int index, Float32x4 value) { | 2167 void operator[]=(int index, Float32x4 value) { |
2173 if (index < 0 || index >= length) { | 2168 if (index < 0 || index >= length) { |
2174 throw _newRangeError(index, length); | 2169 throw new RangeError.index(index, this, "index"); |
2175 } | 2170 } |
2176 _setIndexedFloat32x4(index, value); | 2171 _setIndexedFloat32x4(index, value); |
2177 } | 2172 } |
2178 | 2173 |
2179 | 2174 |
2180 // Method(s) implementing the TypedData interface. | 2175 // Method(s) implementing the TypedData interface. |
2181 | 2176 |
2182 int get elementSizeInBytes { | 2177 int get elementSizeInBytes { |
2183 return Float32x4List.BYTES_PER_ELEMENT; | 2178 return Float32x4List.BYTES_PER_ELEMENT; |
2184 } | 2179 } |
(...skipping 23 matching lines...) Expand all Loading... |
2208 | 2203 |
2209 factory _ExternalInt32x4Array(int length) { | 2204 factory _ExternalInt32x4Array(int length) { |
2210 return _new(length); | 2205 return _new(length); |
2211 } | 2206 } |
2212 | 2207 |
2213 | 2208 |
2214 // Method(s) implementing the List interface. | 2209 // Method(s) implementing the List interface. |
2215 | 2210 |
2216 Int32x4 operator[](int index) { | 2211 Int32x4 operator[](int index) { |
2217 if (index < 0 || index >= length) { | 2212 if (index < 0 || index >= length) { |
2218 throw _newRangeError(index, length); | 2213 throw new RangeError.index(index, this, "index"); |
2219 } | 2214 } |
2220 return _getIndexedInt32x4(index); | 2215 return _getIndexedInt32x4(index); |
2221 } | 2216 } |
2222 | 2217 |
2223 void operator[]=(int index, Int32x4 value) { | 2218 void operator[]=(int index, Int32x4 value) { |
2224 if (index < 0 || index >= length) { | 2219 if (index < 0 || index >= length) { |
2225 throw _newRangeError(index, length); | 2220 throw new RangeError.index(index, this, "index"); |
2226 } | 2221 } |
2227 _setIndexedInt32x4(index, value); | 2222 _setIndexedInt32x4(index, value); |
2228 } | 2223 } |
2229 | 2224 |
2230 | 2225 |
2231 // Method(s) implementing the TypedData interface. | 2226 // Method(s) implementing the TypedData interface. |
2232 | 2227 |
2233 int get elementSizeInBytes { | 2228 int get elementSizeInBytes { |
2234 return Int32x4List.BYTES_PER_ELEMENT; | 2229 return Int32x4List.BYTES_PER_ELEMENT; |
2235 } | 2230 } |
(...skipping 23 matching lines...) Expand all Loading... |
2259 | 2254 |
2260 factory _ExternalFloat64x2Array(int length) { | 2255 factory _ExternalFloat64x2Array(int length) { |
2261 return _new(length); | 2256 return _new(length); |
2262 } | 2257 } |
2263 | 2258 |
2264 | 2259 |
2265 // Method(s) implementing the List interface. | 2260 // Method(s) implementing the List interface. |
2266 | 2261 |
2267 Float64x2 operator[](int index) { | 2262 Float64x2 operator[](int index) { |
2268 if (index < 0 || index >= length) { | 2263 if (index < 0 || index >= length) { |
2269 throw _newRangeError(index, length); | 2264 throw new RangeError.index(index, this, "index"); |
2270 } | 2265 } |
2271 return _getIndexedFloat64x2(index); | 2266 return _getIndexedFloat64x2(index); |
2272 } | 2267 } |
2273 | 2268 |
2274 void operator[]=(int index, Float64x2 value) { | 2269 void operator[]=(int index, Float64x2 value) { |
2275 if (index < 0 || index >= length) { | 2270 if (index < 0 || index >= length) { |
2276 throw _newRangeError(index, length); | 2271 throw new RangeError.index(index, this, "index"); |
2277 } | 2272 } |
2278 _setIndexedFloat64x2(index, value); | 2273 _setIndexedFloat64x2(index, value); |
2279 } | 2274 } |
2280 | 2275 |
2281 | 2276 |
2282 // Method(s) implementing the TypedData interface. | 2277 // Method(s) implementing the TypedData interface. |
2283 | 2278 |
2284 int get elementSizeInBytes { | 2279 int get elementSizeInBytes { |
2285 return Float64x2List.BYTES_PER_ELEMENT; | 2280 return Float64x2List.BYTES_PER_ELEMENT; |
2286 } | 2281 } |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2587 _rangeCheck(buffer.lengthInBytes, | 2582 _rangeCheck(buffer.lengthInBytes, |
2588 _offsetInBytes, | 2583 _offsetInBytes, |
2589 length * Int8List.BYTES_PER_ELEMENT); | 2584 length * Int8List.BYTES_PER_ELEMENT); |
2590 } | 2585 } |
2591 | 2586 |
2592 | 2587 |
2593 // Method(s) implementing List interface. | 2588 // Method(s) implementing List interface. |
2594 | 2589 |
2595 int operator[](int index) { | 2590 int operator[](int index) { |
2596 if (index < 0 || index >= length) { | 2591 if (index < 0 || index >= length) { |
2597 throw _newRangeError(index, length); | 2592 throw new RangeError.index(index, this, "index"); |
2598 } | 2593 } |
2599 return _typedData._getInt8(offsetInBytes + | 2594 return _typedData._getInt8(offsetInBytes + |
2600 (index * Int8List.BYTES_PER_ELEMENT)); | 2595 (index * Int8List.BYTES_PER_ELEMENT)); |
2601 } | 2596 } |
2602 | 2597 |
2603 void operator[]=(int index, int value) { | 2598 void operator[]=(int index, int value) { |
2604 if (index < 0 || index >= length) { | 2599 if (index < 0 || index >= length) { |
2605 throw _newRangeError(index, length); | 2600 throw new RangeError.index(index, this, "index"); |
2606 } | 2601 } |
2607 _typedData._setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT), | 2602 _typedData._setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT), |
2608 _toInt8(value)); | 2603 _toInt8(value)); |
2609 } | 2604 } |
2610 | 2605 |
2611 | 2606 |
2612 // Method(s) implementing TypedData interface. | 2607 // Method(s) implementing TypedData interface. |
2613 | 2608 |
2614 int get elementSizeInBytes { | 2609 int get elementSizeInBytes { |
2615 return Int8List.BYTES_PER_ELEMENT; | 2610 return Int8List.BYTES_PER_ELEMENT; |
(...skipping 18 matching lines...) Expand all Loading... |
2634 _rangeCheck(buffer.lengthInBytes, | 2629 _rangeCheck(buffer.lengthInBytes, |
2635 _offsetInBytes, | 2630 _offsetInBytes, |
2636 length * Uint8List.BYTES_PER_ELEMENT); | 2631 length * Uint8List.BYTES_PER_ELEMENT); |
2637 } | 2632 } |
2638 | 2633 |
2639 | 2634 |
2640 // Method(s) implementing List interface. | 2635 // Method(s) implementing List interface. |
2641 | 2636 |
2642 int operator[](int index) { | 2637 int operator[](int index) { |
2643 if (index < 0 || index >= length) { | 2638 if (index < 0 || index >= length) { |
2644 throw _newRangeError(index, length); | 2639 throw new RangeError.index(index, this, "index"); |
2645 } | 2640 } |
2646 return _typedData._getUint8(offsetInBytes + | 2641 return _typedData._getUint8(offsetInBytes + |
2647 (index * Uint8List.BYTES_PER_ELEMENT)); | 2642 (index * Uint8List.BYTES_PER_ELEMENT)); |
2648 } | 2643 } |
2649 | 2644 |
2650 void operator[]=(int index, int value) { | 2645 void operator[]=(int index, int value) { |
2651 if (index < 0 || index >= length) { | 2646 if (index < 0 || index >= length) { |
2652 throw _newRangeError(index, length); | 2647 throw new RangeError.index(index, this, "index"); |
2653 } | 2648 } |
2654 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), | 2649 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), |
2655 _toUint8(value)); | 2650 _toUint8(value)); |
2656 } | 2651 } |
2657 | 2652 |
2658 | 2653 |
2659 // Method(s) implementing TypedData interface. | 2654 // Method(s) implementing TypedData interface. |
2660 | 2655 |
2661 int get elementSizeInBytes { | 2656 int get elementSizeInBytes { |
2662 return Uint8List.BYTES_PER_ELEMENT; | 2657 return Uint8List.BYTES_PER_ELEMENT; |
(...skipping 19 matching lines...) Expand all Loading... |
2682 _rangeCheck(buffer.lengthInBytes, | 2677 _rangeCheck(buffer.lengthInBytes, |
2683 offsetInBytes, | 2678 offsetInBytes, |
2684 length * Uint8List.BYTES_PER_ELEMENT); | 2679 length * Uint8List.BYTES_PER_ELEMENT); |
2685 } | 2680 } |
2686 | 2681 |
2687 | 2682 |
2688 // Method(s) implementing List interface. | 2683 // Method(s) implementing List interface. |
2689 | 2684 |
2690 int operator[](int index) { | 2685 int operator[](int index) { |
2691 if (index < 0 || index >= length) { | 2686 if (index < 0 || index >= length) { |
2692 throw _newRangeError(index, length); | 2687 throw new RangeError.index(index, this, "index"); |
2693 } | 2688 } |
2694 return _typedData._getUint8(offsetInBytes + | 2689 return _typedData._getUint8(offsetInBytes + |
2695 (index * Uint8List.BYTES_PER_ELEMENT)); | 2690 (index * Uint8List.BYTES_PER_ELEMENT)); |
2696 } | 2691 } |
2697 | 2692 |
2698 void operator[]=(int index, int value) { | 2693 void operator[]=(int index, int value) { |
2699 if (index < 0 || index >= length) { | 2694 if (index < 0 || index >= length) { |
2700 throw _newRangeError(index, length); | 2695 throw new RangeError.index(index, this, "index"); |
2701 } | 2696 } |
2702 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), | 2697 _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), |
2703 _toClampedUint8(value)); | 2698 _toClampedUint8(value)); |
2704 } | 2699 } |
2705 | 2700 |
2706 | 2701 |
2707 // Method(s) implementing TypedData interface. | 2702 // Method(s) implementing TypedData interface. |
2708 | 2703 |
2709 int get elementSizeInBytes { | 2704 int get elementSizeInBytes { |
2710 return Uint8List.BYTES_PER_ELEMENT; | 2705 return Uint8List.BYTES_PER_ELEMENT; |
(...skipping 19 matching lines...) Expand all Loading... |
2730 offsetInBytes, | 2725 offsetInBytes, |
2731 length * Int16List.BYTES_PER_ELEMENT); | 2726 length * Int16List.BYTES_PER_ELEMENT); |
2732 _offsetAlignmentCheck(_offsetInBytes, Int16List.BYTES_PER_ELEMENT); | 2727 _offsetAlignmentCheck(_offsetInBytes, Int16List.BYTES_PER_ELEMENT); |
2733 } | 2728 } |
2734 | 2729 |
2735 | 2730 |
2736 // Method(s) implementing List interface. | 2731 // Method(s) implementing List interface. |
2737 | 2732 |
2738 int operator[](int index) { | 2733 int operator[](int index) { |
2739 if (index < 0 || index >= length) { | 2734 if (index < 0 || index >= length) { |
2740 throw _newRangeError(index, length); | 2735 throw new RangeError.index(index, this, "index"); |
2741 } | 2736 } |
2742 return _typedData._getInt16(offsetInBytes + | 2737 return _typedData._getInt16(offsetInBytes + |
2743 (index * Int16List.BYTES_PER_ELEMENT)); | 2738 (index * Int16List.BYTES_PER_ELEMENT)); |
2744 } | 2739 } |
2745 | 2740 |
2746 void operator[]=(int index, int value) { | 2741 void operator[]=(int index, int value) { |
2747 if (index < 0 || index >= length) { | 2742 if (index < 0 || index >= length) { |
2748 throw _newRangeError(index, length); | 2743 throw new RangeError.index(index, this, "index"); |
2749 } | 2744 } |
2750 _typedData._setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT), | 2745 _typedData._setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT), |
2751 _toInt16(value)); | 2746 _toInt16(value)); |
2752 } | 2747 } |
2753 | 2748 |
2754 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { | 2749 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { |
2755 if (ClassID.getID(iterable) == CodeUnits.cid) { | 2750 if (ClassID.getID(iterable) == CodeUnits.cid) { |
2756 end = RangeError.checkValidRange(start, end, this.length); | 2751 end = RangeError.checkValidRange(start, end, this.length); |
2757 int length = end - start; | 2752 int length = end - start; |
2758 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT; | 2753 int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT; |
(...skipping 29 matching lines...) Expand all Loading... |
2788 offsetInBytes, | 2783 offsetInBytes, |
2789 length * Uint16List.BYTES_PER_ELEMENT); | 2784 length * Uint16List.BYTES_PER_ELEMENT); |
2790 _offsetAlignmentCheck(_offsetInBytes, Uint16List.BYTES_PER_ELEMENT); | 2785 _offsetAlignmentCheck(_offsetInBytes, Uint16List.BYTES_PER_ELEMENT); |
2791 } | 2786 } |
2792 | 2787 |
2793 | 2788 |
2794 // Method(s) implementing List interface. | 2789 // Method(s) implementing List interface. |
2795 | 2790 |
2796 int operator[](int index) { | 2791 int operator[](int index) { |
2797 if (index < 0 || index >= length) { | 2792 if (index < 0 || index >= length) { |
2798 throw _newRangeError(index, length); | 2793 throw new RangeError.index(index, this, "index"); |
2799 } | 2794 } |
2800 return _typedData._getUint16(offsetInBytes + | 2795 return _typedData._getUint16(offsetInBytes + |
2801 (index * Uint16List.BYTES_PER_ELEMENT)); | 2796 (index * Uint16List.BYTES_PER_ELEMENT)); |
2802 } | 2797 } |
2803 | 2798 |
2804 void operator[]=(int index, int value) { | 2799 void operator[]=(int index, int value) { |
2805 if (index < 0 || index >= length) { | 2800 if (index < 0 || index >= length) { |
2806 throw _newRangeError(index, length); | 2801 throw new RangeError.index(index, this, "index"); |
2807 } | 2802 } |
2808 _typedData._setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT)
, | 2803 _typedData._setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT)
, |
2809 _toUint16(value)); | 2804 _toUint16(value)); |
2810 } | 2805 } |
2811 | 2806 |
2812 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { | 2807 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { |
2813 if (ClassID.getID(iterable) == CodeUnits.cid) { | 2808 if (ClassID.getID(iterable) == CodeUnits.cid) { |
2814 end = RangeError.checkValidRange(start, end, this.length); | 2809 end = RangeError.checkValidRange(start, end, this.length); |
2815 int length = end - start; | 2810 int length = end - start; |
2816 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT; | 2811 int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT; |
(...skipping 28 matching lines...) Expand all Loading... |
2845 offsetInBytes, | 2840 offsetInBytes, |
2846 length * Int32List.BYTES_PER_ELEMENT); | 2841 length * Int32List.BYTES_PER_ELEMENT); |
2847 _offsetAlignmentCheck(_offsetInBytes, Int32List.BYTES_PER_ELEMENT); | 2842 _offsetAlignmentCheck(_offsetInBytes, Int32List.BYTES_PER_ELEMENT); |
2848 } | 2843 } |
2849 | 2844 |
2850 | 2845 |
2851 // Method(s) implementing List interface. | 2846 // Method(s) implementing List interface. |
2852 | 2847 |
2853 int operator[](int index) { | 2848 int operator[](int index) { |
2854 if (index < 0 || index >= length) { | 2849 if (index < 0 || index >= length) { |
2855 throw _newRangeError(index, length); | 2850 throw new RangeError.index(index, this, "index"); |
2856 } | 2851 } |
2857 return _typedData._getInt32(offsetInBytes + | 2852 return _typedData._getInt32(offsetInBytes + |
2858 (index * Int32List.BYTES_PER_ELEMENT)); | 2853 (index * Int32List.BYTES_PER_ELEMENT)); |
2859 } | 2854 } |
2860 | 2855 |
2861 void operator[]=(int index, int value) { | 2856 void operator[]=(int index, int value) { |
2862 if (index < 0 || index >= length) { | 2857 if (index < 0 || index >= length) { |
2863 throw _newRangeError(index, length); | 2858 throw new RangeError.index(index, this, "index"); |
2864 } | 2859 } |
2865 _typedData._setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT), | 2860 _typedData._setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT), |
2866 _toInt32(value)); | 2861 _toInt32(value)); |
2867 } | 2862 } |
2868 | 2863 |
2869 | 2864 |
2870 // Method(s) implementing TypedData interface. | 2865 // Method(s) implementing TypedData interface. |
2871 | 2866 |
2872 int get elementSizeInBytes { | 2867 int get elementSizeInBytes { |
2873 return Int32List.BYTES_PER_ELEMENT; | 2868 return Int32List.BYTES_PER_ELEMENT; |
(...skipping 19 matching lines...) Expand all Loading... |
2893 offsetInBytes, | 2888 offsetInBytes, |
2894 length * Uint32List.BYTES_PER_ELEMENT); | 2889 length * Uint32List.BYTES_PER_ELEMENT); |
2895 _offsetAlignmentCheck(_offsetInBytes, Uint32List.BYTES_PER_ELEMENT); | 2890 _offsetAlignmentCheck(_offsetInBytes, Uint32List.BYTES_PER_ELEMENT); |
2896 } | 2891 } |
2897 | 2892 |
2898 | 2893 |
2899 // Method(s) implementing List interface. | 2894 // Method(s) implementing List interface. |
2900 | 2895 |
2901 int operator[](int index) { | 2896 int operator[](int index) { |
2902 if (index < 0 || index >= length) { | 2897 if (index < 0 || index >= length) { |
2903 throw _newRangeError(index, length); | 2898 throw new RangeError.index(index, this, "index"); |
2904 } | 2899 } |
2905 return _typedData._getUint32(offsetInBytes + | 2900 return _typedData._getUint32(offsetInBytes + |
2906 (index * Uint32List.BYTES_PER_ELEMENT)); | 2901 (index * Uint32List.BYTES_PER_ELEMENT)); |
2907 } | 2902 } |
2908 | 2903 |
2909 void operator[]=(int index, int value) { | 2904 void operator[]=(int index, int value) { |
2910 if (index < 0 || index >= length) { | 2905 if (index < 0 || index >= length) { |
2911 throw _newRangeError(index, length); | 2906 throw new RangeError.index(index, this, "index"); |
2912 } | 2907 } |
2913 _typedData._setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT)
, | 2908 _typedData._setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT)
, |
2914 _toUint32(value)); | 2909 _toUint32(value)); |
2915 } | 2910 } |
2916 | 2911 |
2917 | 2912 |
2918 // Method(s) implementing TypedData interface. | 2913 // Method(s) implementing TypedData interface. |
2919 | 2914 |
2920 int get elementSizeInBytes { | 2915 int get elementSizeInBytes { |
2921 return Uint32List.BYTES_PER_ELEMENT; | 2916 return Uint32List.BYTES_PER_ELEMENT; |
(...skipping 19 matching lines...) Expand all Loading... |
2941 offsetInBytes, | 2936 offsetInBytes, |
2942 length * Int64List.BYTES_PER_ELEMENT); | 2937 length * Int64List.BYTES_PER_ELEMENT); |
2943 _offsetAlignmentCheck(_offsetInBytes, Int64List.BYTES_PER_ELEMENT); | 2938 _offsetAlignmentCheck(_offsetInBytes, Int64List.BYTES_PER_ELEMENT); |
2944 } | 2939 } |
2945 | 2940 |
2946 | 2941 |
2947 // Method(s) implementing List interface. | 2942 // Method(s) implementing List interface. |
2948 | 2943 |
2949 int operator[](int index) { | 2944 int operator[](int index) { |
2950 if (index < 0 || index >= length) { | 2945 if (index < 0 || index >= length) { |
2951 throw _newRangeError(index, length); | 2946 throw new RangeError.index(index, this, "index"); |
2952 } | 2947 } |
2953 return _typedData._getInt64(offsetInBytes + | 2948 return _typedData._getInt64(offsetInBytes + |
2954 (index * Int64List.BYTES_PER_ELEMENT)); | 2949 (index * Int64List.BYTES_PER_ELEMENT)); |
2955 } | 2950 } |
2956 | 2951 |
2957 void operator[]=(int index, int value) { | 2952 void operator[]=(int index, int value) { |
2958 if (index < 0 || index >= length) { | 2953 if (index < 0 || index >= length) { |
2959 throw _newRangeError(index, length); | 2954 throw new RangeError.index(index, this, "index"); |
2960 } | 2955 } |
2961 _typedData._setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT), | 2956 _typedData._setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT), |
2962 _toInt64(value)); | 2957 _toInt64(value)); |
2963 } | 2958 } |
2964 | 2959 |
2965 | 2960 |
2966 // Method(s) implementing TypedData interface. | 2961 // Method(s) implementing TypedData interface. |
2967 | 2962 |
2968 int get elementSizeInBytes { | 2963 int get elementSizeInBytes { |
2969 return Int64List.BYTES_PER_ELEMENT; | 2964 return Int64List.BYTES_PER_ELEMENT; |
(...skipping 19 matching lines...) Expand all Loading... |
2989 offsetInBytes, | 2984 offsetInBytes, |
2990 length * Uint64List.BYTES_PER_ELEMENT); | 2985 length * Uint64List.BYTES_PER_ELEMENT); |
2991 _offsetAlignmentCheck(_offsetInBytes, Uint64List.BYTES_PER_ELEMENT); | 2986 _offsetAlignmentCheck(_offsetInBytes, Uint64List.BYTES_PER_ELEMENT); |
2992 } | 2987 } |
2993 | 2988 |
2994 | 2989 |
2995 // Method(s) implementing List interface. | 2990 // Method(s) implementing List interface. |
2996 | 2991 |
2997 int operator[](int index) { | 2992 int operator[](int index) { |
2998 if (index < 0 || index >= length) { | 2993 if (index < 0 || index >= length) { |
2999 throw _newRangeError(index, length); | 2994 throw new RangeError.index(index, this, "index"); |
3000 } | 2995 } |
3001 return _typedData._getUint64(offsetInBytes + | 2996 return _typedData._getUint64(offsetInBytes + |
3002 (index * Uint64List.BYTES_PER_ELEMENT)); | 2997 (index * Uint64List.BYTES_PER_ELEMENT)); |
3003 } | 2998 } |
3004 | 2999 |
3005 void operator[]=(int index, int value) { | 3000 void operator[]=(int index, int value) { |
3006 if (index < 0 || index >= length) { | 3001 if (index < 0 || index >= length) { |
3007 throw _newRangeError(index, length); | 3002 throw new RangeError.index(index, this, "index"); |
3008 } | 3003 } |
3009 _typedData._setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT)
, | 3004 _typedData._setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT)
, |
3010 _toUint64(value)); | 3005 _toUint64(value)); |
3011 } | 3006 } |
3012 | 3007 |
3013 | 3008 |
3014 // Method(s) implementing TypedData interface. | 3009 // Method(s) implementing TypedData interface. |
3015 | 3010 |
3016 int get elementSizeInBytes { | 3011 int get elementSizeInBytes { |
3017 return Uint64List.BYTES_PER_ELEMENT; | 3012 return Uint64List.BYTES_PER_ELEMENT; |
(...skipping 19 matching lines...) Expand all Loading... |
3037 offsetInBytes, | 3032 offsetInBytes, |
3038 length * Float32List.BYTES_PER_ELEMENT); | 3033 length * Float32List.BYTES_PER_ELEMENT); |
3039 _offsetAlignmentCheck(_offsetInBytes, Float32List.BYTES_PER_ELEMENT); | 3034 _offsetAlignmentCheck(_offsetInBytes, Float32List.BYTES_PER_ELEMENT); |
3040 } | 3035 } |
3041 | 3036 |
3042 | 3037 |
3043 // Method(s) implementing List interface. | 3038 // Method(s) implementing List interface. |
3044 | 3039 |
3045 double operator[](int index) { | 3040 double operator[](int index) { |
3046 if (index < 0 || index >= length) { | 3041 if (index < 0 || index >= length) { |
3047 throw _newRangeError(index, length); | 3042 throw new RangeError.index(index, this, "index"); |
3048 } | 3043 } |
3049 return _typedData._getFloat32(offsetInBytes + | 3044 return _typedData._getFloat32(offsetInBytes + |
3050 (index * Float32List.BYTES_PER_ELEMENT)); | 3045 (index * Float32List.BYTES_PER_ELEMENT)); |
3051 } | 3046 } |
3052 | 3047 |
3053 void operator[]=(int index, double value) { | 3048 void operator[]=(int index, double value) { |
3054 if (index < 0 || index >= length) { | 3049 if (index < 0 || index >= length) { |
3055 throw _newRangeError(index, length); | 3050 throw new RangeError.index(index, this, "index"); |
3056 } | 3051 } |
3057 _typedData._setFloat32(offsetInBytes + | 3052 _typedData._setFloat32(offsetInBytes + |
3058 (index * Float32List.BYTES_PER_ELEMENT), value); | 3053 (index * Float32List.BYTES_PER_ELEMENT), value); |
3059 } | 3054 } |
3060 | 3055 |
3061 | 3056 |
3062 // Method(s) implementing TypedData interface. | 3057 // Method(s) implementing TypedData interface. |
3063 | 3058 |
3064 int get elementSizeInBytes { | 3059 int get elementSizeInBytes { |
3065 return Float32List.BYTES_PER_ELEMENT; | 3060 return Float32List.BYTES_PER_ELEMENT; |
(...skipping 19 matching lines...) Expand all Loading... |
3085 offsetInBytes, | 3080 offsetInBytes, |
3086 length * Float64List.BYTES_PER_ELEMENT); | 3081 length * Float64List.BYTES_PER_ELEMENT); |
3087 _offsetAlignmentCheck(_offsetInBytes, Float64List.BYTES_PER_ELEMENT); | 3082 _offsetAlignmentCheck(_offsetInBytes, Float64List.BYTES_PER_ELEMENT); |
3088 } | 3083 } |
3089 | 3084 |
3090 | 3085 |
3091 // Method(s) implementing List interface. | 3086 // Method(s) implementing List interface. |
3092 | 3087 |
3093 double operator[](int index) { | 3088 double operator[](int index) { |
3094 if (index < 0 || index >= length) { | 3089 if (index < 0 || index >= length) { |
3095 throw _newRangeError(index, length); | 3090 throw new RangeError.index(index, this, "index"); |
3096 } | 3091 } |
3097 return _typedData._getFloat64(offsetInBytes + | 3092 return _typedData._getFloat64(offsetInBytes + |
3098 (index * Float64List.BYTES_PER_ELEMENT)); | 3093 (index * Float64List.BYTES_PER_ELEMENT)); |
3099 } | 3094 } |
3100 | 3095 |
3101 void operator[]=(int index, double value) { | 3096 void operator[]=(int index, double value) { |
3102 if (index < 0 || index >= length) { | 3097 if (index < 0 || index >= length) { |
3103 throw _newRangeError(index, length); | 3098 throw new RangeError.index(index, this, "index"); |
3104 } | 3099 } |
3105 _typedData._setFloat64(offsetInBytes + | 3100 _typedData._setFloat64(offsetInBytes + |
3106 (index * Float64List.BYTES_PER_ELEMENT), value); | 3101 (index * Float64List.BYTES_PER_ELEMENT), value); |
3107 } | 3102 } |
3108 | 3103 |
3109 | 3104 |
3110 // Method(s) implementing TypedData interface. | 3105 // Method(s) implementing TypedData interface. |
3111 | 3106 |
3112 int get elementSizeInBytes { | 3107 int get elementSizeInBytes { |
3113 return Float64List.BYTES_PER_ELEMENT; | 3108 return Float64List.BYTES_PER_ELEMENT; |
(...skipping 19 matching lines...) Expand all Loading... |
3133 offsetInBytes, | 3128 offsetInBytes, |
3134 length * Float32x4List.BYTES_PER_ELEMENT); | 3129 length * Float32x4List.BYTES_PER_ELEMENT); |
3135 _offsetAlignmentCheck(_offsetInBytes, Float32x4List.BYTES_PER_ELEMENT); | 3130 _offsetAlignmentCheck(_offsetInBytes, Float32x4List.BYTES_PER_ELEMENT); |
3136 } | 3131 } |
3137 | 3132 |
3138 | 3133 |
3139 // Method(s) implementing List interface. | 3134 // Method(s) implementing List interface. |
3140 | 3135 |
3141 Float32x4 operator[](int index) { | 3136 Float32x4 operator[](int index) { |
3142 if (index < 0 || index >= length) { | 3137 if (index < 0 || index >= length) { |
3143 throw _newRangeError(index, length); | 3138 throw new RangeError.index(index, this, "index"); |
3144 } | 3139 } |
3145 return _typedData._getFloat32x4(offsetInBytes + | 3140 return _typedData._getFloat32x4(offsetInBytes + |
3146 (index * Float32x4List.BYTES_PER_ELEMENT)); | 3141 (index * Float32x4List.BYTES_PER_ELEMENT)); |
3147 } | 3142 } |
3148 | 3143 |
3149 void operator[]=(int index, Float32x4 value) { | 3144 void operator[]=(int index, Float32x4 value) { |
3150 if (index < 0 || index >= length) { | 3145 if (index < 0 || index >= length) { |
3151 throw _newRangeError(index, length); | 3146 throw new RangeError.index(index, this, "index"); |
3152 } | 3147 } |
3153 _typedData._setFloat32x4(offsetInBytes + | 3148 _typedData._setFloat32x4(offsetInBytes + |
3154 (index * Float32x4List.BYTES_PER_ELEMENT), value); | 3149 (index * Float32x4List.BYTES_PER_ELEMENT), value); |
3155 } | 3150 } |
3156 | 3151 |
3157 | 3152 |
3158 // Method(s) implementing TypedData interface. | 3153 // Method(s) implementing TypedData interface. |
3159 | 3154 |
3160 int get elementSizeInBytes { | 3155 int get elementSizeInBytes { |
3161 return Float32x4List.BYTES_PER_ELEMENT; | 3156 return Float32x4List.BYTES_PER_ELEMENT; |
(...skipping 19 matching lines...) Expand all Loading... |
3181 offsetInBytes, | 3176 offsetInBytes, |
3182 length * Int32x4List.BYTES_PER_ELEMENT); | 3177 length * Int32x4List.BYTES_PER_ELEMENT); |
3183 _offsetAlignmentCheck(_offsetInBytes, Int32x4List.BYTES_PER_ELEMENT); | 3178 _offsetAlignmentCheck(_offsetInBytes, Int32x4List.BYTES_PER_ELEMENT); |
3184 } | 3179 } |
3185 | 3180 |
3186 | 3181 |
3187 // Method(s) implementing List interface. | 3182 // Method(s) implementing List interface. |
3188 | 3183 |
3189 Int32x4 operator[](int index) { | 3184 Int32x4 operator[](int index) { |
3190 if (index < 0 || index >= length) { | 3185 if (index < 0 || index >= length) { |
3191 throw _newRangeError(index, length); | 3186 throw new RangeError.index(index, this, "index"); |
3192 } | 3187 } |
3193 return _typedData._getInt32x4(offsetInBytes + | 3188 return _typedData._getInt32x4(offsetInBytes + |
3194 (index * Int32x4List.BYTES_PER_ELEMENT)); | 3189 (index * Int32x4List.BYTES_PER_ELEMENT)); |
3195 } | 3190 } |
3196 | 3191 |
3197 void operator[]=(int index, Int32x4 value) { | 3192 void operator[]=(int index, Int32x4 value) { |
3198 if (index < 0 || index >= length) { | 3193 if (index < 0 || index >= length) { |
3199 throw _newRangeError(index, length); | 3194 throw new RangeError.index(index, this, "index"); |
3200 } | 3195 } |
3201 _typedData._setInt32x4(offsetInBytes + | 3196 _typedData._setInt32x4(offsetInBytes + |
3202 (index * Int32x4List.BYTES_PER_ELEMENT), value); | 3197 (index * Int32x4List.BYTES_PER_ELEMENT), value); |
3203 } | 3198 } |
3204 | 3199 |
3205 | 3200 |
3206 // Method(s) implementing TypedData interface. | 3201 // Method(s) implementing TypedData interface. |
3207 | 3202 |
3208 int get elementSizeInBytes { | 3203 int get elementSizeInBytes { |
3209 return Int32x4List.BYTES_PER_ELEMENT; | 3204 return Int32x4List.BYTES_PER_ELEMENT; |
(...skipping 19 matching lines...) Expand all Loading... |
3229 offsetInBytes, | 3224 offsetInBytes, |
3230 length * Float64x2List.BYTES_PER_ELEMENT); | 3225 length * Float64x2List.BYTES_PER_ELEMENT); |
3231 _offsetAlignmentCheck(_offsetInBytes, Float64x2List.BYTES_PER_ELEMENT); | 3226 _offsetAlignmentCheck(_offsetInBytes, Float64x2List.BYTES_PER_ELEMENT); |
3232 } | 3227 } |
3233 | 3228 |
3234 | 3229 |
3235 // Method(s) implementing List interface. | 3230 // Method(s) implementing List interface. |
3236 | 3231 |
3237 Float64x2 operator[](int index) { | 3232 Float64x2 operator[](int index) { |
3238 if (index < 0 || index >= length) { | 3233 if (index < 0 || index >= length) { |
3239 throw _newRangeError(index, length); | 3234 throw new RangeError.index(index, this, "index"); |
3240 } | 3235 } |
3241 return _typedData._getFloat64x2(offsetInBytes + | 3236 return _typedData._getFloat64x2(offsetInBytes + |
3242 (index * Float64x2List.BYTES_PER_ELEMENT)); | 3237 (index * Float64x2List.BYTES_PER_ELEMENT)); |
3243 } | 3238 } |
3244 | 3239 |
3245 void operator[]=(int index, Float64x2 value) { | 3240 void operator[]=(int index, Float64x2 value) { |
3246 if (index < 0 || index >= length) { | 3241 if (index < 0 || index >= length) { |
3247 throw _newRangeError(index, length); | 3242 throw new RangeError.index(index, this, "index"); |
3248 } | 3243 } |
3249 _typedData._setFloat64x2(offsetInBytes + | 3244 _typedData._setFloat64x2(offsetInBytes + |
3250 (index * Float64x2List.BYTES_PER_ELEMENT), value); | 3245 (index * Float64x2List.BYTES_PER_ELEMENT), value); |
3251 } | 3246 } |
3252 | 3247 |
3253 | 3248 |
3254 // Method(s) implementing TypedData interface. | 3249 // Method(s) implementing TypedData interface. |
3255 | 3250 |
3256 int get elementSizeInBytes { | 3251 int get elementSizeInBytes { |
3257 return Float64x2List.BYTES_PER_ELEMENT; | 3252 return Float64x2List.BYTES_PER_ELEMENT; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3290 } | 3285 } |
3291 | 3286 |
3292 int get elementSizeInBytes { | 3287 int get elementSizeInBytes { |
3293 return 1; | 3288 return 1; |
3294 } | 3289 } |
3295 | 3290 |
3296 // Method(s) implementing ByteData interface. | 3291 // Method(s) implementing ByteData interface. |
3297 | 3292 |
3298 int getInt8(int byteOffset) { | 3293 int getInt8(int byteOffset) { |
3299 if (byteOffset < 0 || byteOffset >= length) { | 3294 if (byteOffset < 0 || byteOffset >= length) { |
3300 throw _newRangeError(byteOffset, length); | 3295 throw new RangeError.index(byteOffset, this, "byteOffset"); |
3301 } | 3296 } |
3302 return _typedData._getInt8(_offset + byteOffset); | 3297 return _typedData._getInt8(_offset + byteOffset); |
3303 } | 3298 } |
3304 void setInt8(int byteOffset, int value) { | 3299 void setInt8(int byteOffset, int value) { |
3305 if (byteOffset < 0 || byteOffset >= length) { | 3300 if (byteOffset < 0 || byteOffset >= length) { |
3306 throw _newRangeError(byteOffset, length); | 3301 throw new RangeError.index(byteOffset, this, "byteOffset"); |
3307 } | 3302 } |
3308 _typedData._setInt8(_offset + byteOffset, value); | 3303 _typedData._setInt8(_offset + byteOffset, value); |
3309 } | 3304 } |
3310 | 3305 |
3311 int getUint8(int byteOffset) { | 3306 int getUint8(int byteOffset) { |
3312 if (byteOffset < 0 || byteOffset >= length) { | 3307 if (byteOffset < 0 || byteOffset >= length) { |
3313 throw _newRangeError(byteOffset, length); | 3308 throw new RangeError.index(byteOffset, this, "byteOffset"); |
3314 } | 3309 } |
3315 return _typedData._getUint8(_offset + byteOffset); | 3310 return _typedData._getUint8(_offset + byteOffset); |
3316 } | 3311 } |
3317 void setUint8(int byteOffset, int value) { | 3312 void setUint8(int byteOffset, int value) { |
3318 if (byteOffset < 0 || byteOffset >= length) { | 3313 if (byteOffset < 0 || byteOffset >= length) { |
3319 throw _newRangeError(byteOffset, length); | 3314 throw new RangeError.index(byteOffset, this, "byteOffset"); |
3320 } | 3315 } |
3321 _typedData._setUint8(_offset + byteOffset, value); | 3316 _typedData._setUint8(_offset + byteOffset, value); |
3322 } | 3317 } |
3323 | 3318 |
3324 int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { | 3319 int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { |
3325 if (byteOffset < 0 || byteOffset + 1 >= length) { | 3320 if (byteOffset < 0 || byteOffset + 1 >= length) { |
3326 throw _newRangeError(byteOffset + 1, length); | 3321 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset"); |
3327 } | 3322 } |
3328 var result = _typedData._getInt16(_offset + byteOffset); | 3323 var result = _typedData._getInt16(_offset + byteOffset); |
3329 if (identical(endian, Endianness.HOST_ENDIAN)) { | 3324 if (identical(endian, Endianness.HOST_ENDIAN)) { |
3330 return result; | 3325 return result; |
3331 } | 3326 } |
3332 return _byteSwap16(result).toSigned(16); | 3327 return _byteSwap16(result).toSigned(16); |
3333 } | 3328 } |
3334 void setInt16(int byteOffset, | 3329 void setInt16(int byteOffset, |
3335 int value, | 3330 int value, |
3336 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3331 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3337 if (byteOffset < 0 || byteOffset + 1 >= length) { | 3332 if (byteOffset < 0 || byteOffset + 1 >= length) { |
3338 throw _newRangeError(byteOffset + 1, length); | 3333 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset"); |
3339 } | 3334 } |
3340 _typedData._setInt16(_offset + byteOffset, | 3335 _typedData._setInt16(_offset + byteOffset, |
3341 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value)); | 3336 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value)); |
3342 } | 3337 } |
3343 | 3338 |
3344 int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { | 3339 int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { |
3345 if (byteOffset < 0 || byteOffset + 1 >= length) { | 3340 if (byteOffset < 0 || byteOffset + 1 >= length) { |
3346 throw _newRangeError(byteOffset + 1, length); | 3341 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset"); |
3347 } | 3342 } |
3348 var result = _typedData._getUint16(_offset + byteOffset); | 3343 var result = _typedData._getUint16(_offset + byteOffset); |
3349 if (identical(endian, Endianness.HOST_ENDIAN)) { | 3344 if (identical(endian, Endianness.HOST_ENDIAN)) { |
3350 return result; | 3345 return result; |
3351 } | 3346 } |
3352 return _byteSwap16(result); | 3347 return _byteSwap16(result); |
3353 } | 3348 } |
3354 void setUint16(int byteOffset, | 3349 void setUint16(int byteOffset, |
3355 int value, | 3350 int value, |
3356 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3351 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3357 if (byteOffset < 0 || byteOffset + 1 >= length) { | 3352 if (byteOffset < 0 || byteOffset + 1 >= length) { |
3358 throw _newRangeError(byteOffset + 1, length); | 3353 throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset"); |
3359 } | 3354 } |
3360 _typedData._setUint16(_offset + byteOffset, | 3355 _typedData._setUint16(_offset + byteOffset, |
3361 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value)); | 3356 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value)); |
3362 } | 3357 } |
3363 | 3358 |
3364 int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { | 3359 int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { |
3365 if (byteOffset < 0 || byteOffset + 3 >= length) { | 3360 if (byteOffset < 0 || byteOffset + 3 >= length) { |
3366 throw _newRangeError(byteOffset + 3, length); | 3361 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); |
3367 } | 3362 } |
3368 var result = _typedData._getInt32(_offset + byteOffset); | 3363 var result = _typedData._getInt32(_offset + byteOffset); |
3369 if (identical(endian, Endianness.HOST_ENDIAN)) { | 3364 if (identical(endian, Endianness.HOST_ENDIAN)) { |
3370 return result; | 3365 return result; |
3371 } | 3366 } |
3372 return _byteSwap32(result).toSigned(32); | 3367 return _byteSwap32(result).toSigned(32); |
3373 } | 3368 } |
3374 void setInt32(int byteOffset, | 3369 void setInt32(int byteOffset, |
3375 int value, | 3370 int value, |
3376 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3371 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3377 if (byteOffset < 0 || byteOffset + 3 >= length) { | 3372 if (byteOffset < 0 || byteOffset + 3 >= length) { |
3378 throw _newRangeError(byteOffset + 3, length); | 3373 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); |
3379 } | 3374 } |
3380 _typedData._setInt32(_offset + byteOffset, | 3375 _typedData._setInt32(_offset + byteOffset, |
3381 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value)); | 3376 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value)); |
3382 } | 3377 } |
3383 | 3378 |
3384 int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { | 3379 int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { |
3385 if (byteOffset < 0 || byteOffset + 3 >= length) { | 3380 if (byteOffset < 0 || byteOffset + 3 >= length) { |
3386 throw _newRangeError(byteOffset + 3, length); | 3381 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); |
3387 } | 3382 } |
3388 var result = _typedData._getUint32(_offset + byteOffset); | 3383 var result = _typedData._getUint32(_offset + byteOffset); |
3389 if (identical(endian, Endianness.HOST_ENDIAN)) { | 3384 if (identical(endian, Endianness.HOST_ENDIAN)) { |
3390 return result; | 3385 return result; |
3391 } | 3386 } |
3392 return _byteSwap32(result); | 3387 return _byteSwap32(result); |
3393 } | 3388 } |
3394 void setUint32(int byteOffset, | 3389 void setUint32(int byteOffset, |
3395 int value, | 3390 int value, |
3396 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3391 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3397 if (byteOffset < 0 || byteOffset + 3 >= length) { | 3392 if (byteOffset < 0 || byteOffset + 3 >= length) { |
3398 throw _newRangeError(byteOffset + 3, length); | 3393 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); |
3399 } | 3394 } |
3400 _typedData._setUint32(_offset + byteOffset, | 3395 _typedData._setUint32(_offset + byteOffset, |
3401 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value)); | 3396 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value)); |
3402 } | 3397 } |
3403 | 3398 |
3404 int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { | 3399 int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { |
3405 if (byteOffset < 0 || byteOffset + 7 >= length) { | 3400 if (byteOffset < 0 || byteOffset + 7 >= length) { |
3406 throw _newRangeError(byteOffset + 7, length); | 3401 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); |
3407 } | 3402 } |
3408 var result = _typedData._getInt64(_offset + byteOffset); | 3403 var result = _typedData._getInt64(_offset + byteOffset); |
3409 if (identical(endian, Endianness.HOST_ENDIAN)) { | 3404 if (identical(endian, Endianness.HOST_ENDIAN)) { |
3410 return result; | 3405 return result; |
3411 } | 3406 } |
3412 return _byteSwap64(result).toSigned(64); | 3407 return _byteSwap64(result).toSigned(64); |
3413 } | 3408 } |
3414 void setInt64(int byteOffset, | 3409 void setInt64(int byteOffset, |
3415 int value, | 3410 int value, |
3416 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3411 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3417 if (byteOffset < 0 || byteOffset + 7 >= length) { | 3412 if (byteOffset < 0 || byteOffset + 7 >= length) { |
3418 throw _newRangeError(byteOffset + 7, length); | 3413 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); |
3419 } | 3414 } |
3420 _typedData._setInt64(_offset + byteOffset, | 3415 _typedData._setInt64(_offset + byteOffset, |
3421 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value)); | 3416 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value)); |
3422 } | 3417 } |
3423 | 3418 |
3424 int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { | 3419 int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) { |
3425 if (byteOffset < 0 || byteOffset + 7 >= length) { | 3420 if (byteOffset < 0 || byteOffset + 7 >= length) { |
3426 throw _newRangeError(byteOffset + 7, length); | 3421 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); |
3427 } | 3422 } |
3428 var result = _typedData._getUint64(_offset + byteOffset); | 3423 var result = _typedData._getUint64(_offset + byteOffset); |
3429 if (identical(endian, Endianness.HOST_ENDIAN)) { | 3424 if (identical(endian, Endianness.HOST_ENDIAN)) { |
3430 return result; | 3425 return result; |
3431 } | 3426 } |
3432 return _byteSwap64(result); | 3427 return _byteSwap64(result); |
3433 } | 3428 } |
3434 void setUint64(int byteOffset, | 3429 void setUint64(int byteOffset, |
3435 int value, | 3430 int value, |
3436 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3431 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3437 if (byteOffset < 0 || byteOffset + 7 >= length) { | 3432 if (byteOffset < 0 || byteOffset + 7 >= length) { |
3438 throw _newRangeError(byteOffset + 7, length); | 3433 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); |
3439 } | 3434 } |
3440 _typedData._setUint64(_offset + byteOffset, | 3435 _typedData._setUint64(_offset + byteOffset, |
3441 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value)); | 3436 identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value)); |
3442 } | 3437 } |
3443 | 3438 |
3444 double getFloat32(int byteOffset, | 3439 double getFloat32(int byteOffset, |
3445 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3440 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3446 if (byteOffset < 0 || byteOffset + 3 >= length) { | 3441 if (byteOffset < 0 || byteOffset + 3 >= length) { |
3447 throw _newRangeError(byteOffset + 3, length); | 3442 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); |
3448 } | 3443 } |
3449 if (identical(endian, Endianness.HOST_ENDIAN)) { | 3444 if (identical(endian, Endianness.HOST_ENDIAN)) { |
3450 return _typedData._getFloat32(_offset + byteOffset); | 3445 return _typedData._getFloat32(_offset + byteOffset); |
3451 } | 3446 } |
3452 _convU32[0] = _byteSwap32(_typedData._getUint32(_offset + byteOffset)); | 3447 _convU32[0] = _byteSwap32(_typedData._getUint32(_offset + byteOffset)); |
3453 return _convF32[0]; | 3448 return _convF32[0]; |
3454 } | 3449 } |
3455 void setFloat32(int byteOffset, | 3450 void setFloat32(int byteOffset, |
3456 double value, | 3451 double value, |
3457 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3452 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3458 if (byteOffset < 0 || byteOffset + 3 >= length) { | 3453 if (byteOffset < 0 || byteOffset + 3 >= length) { |
3459 throw _newRangeError(byteOffset + 3, length); | 3454 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); |
3460 } | 3455 } |
3461 if (identical(endian, Endianness.HOST_ENDIAN)) { | 3456 if (identical(endian, Endianness.HOST_ENDIAN)) { |
3462 _typedData._setFloat32(_offset + byteOffset, value); | 3457 _typedData._setFloat32(_offset + byteOffset, value); |
3463 return; | 3458 return; |
3464 } | 3459 } |
3465 _convF32[0] = value; | 3460 _convF32[0] = value; |
3466 _typedData._setUint32(_offset + byteOffset, _byteSwap32(_convU32[0])); | 3461 _typedData._setUint32(_offset + byteOffset, _byteSwap32(_convU32[0])); |
3467 } | 3462 } |
3468 | 3463 |
3469 double getFloat64(int byteOffset, | 3464 double getFloat64(int byteOffset, |
3470 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3465 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3471 if (byteOffset < 0 || byteOffset + 7 >= length) { | 3466 if (byteOffset < 0 || byteOffset + 7 >= length) { |
3472 throw _newRangeError(byteOffset + 7, length); | 3467 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); |
3473 } | 3468 } |
3474 if (identical(endian, Endianness.HOST_ENDIAN)) { | 3469 if (identical(endian, Endianness.HOST_ENDIAN)) { |
3475 return _typedData._getFloat64(_offset + byteOffset); | 3470 return _typedData._getFloat64(_offset + byteOffset); |
3476 } | 3471 } |
3477 _convU64[0] = _byteSwap64(_typedData._getUint64(_offset + byteOffset)); | 3472 _convU64[0] = _byteSwap64(_typedData._getUint64(_offset + byteOffset)); |
3478 return _convF64[0]; | 3473 return _convF64[0]; |
3479 } | 3474 } |
3480 void setFloat64(int byteOffset, | 3475 void setFloat64(int byteOffset, |
3481 double value, | 3476 double value, |
3482 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3477 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3483 if (byteOffset < 0 || byteOffset + 7 >= length) { | 3478 if (byteOffset < 0 || byteOffset + 7 >= length) { |
3484 throw _newRangeError(byteOffset + 7, length); | 3479 throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset"); |
3485 } | 3480 } |
3486 if (identical(endian, Endianness.HOST_ENDIAN)) { | 3481 if (identical(endian, Endianness.HOST_ENDIAN)) { |
3487 _typedData._setFloat64(_offset + byteOffset, value); | 3482 _typedData._setFloat64(_offset + byteOffset, value); |
3488 return; | 3483 return; |
3489 } | 3484 } |
3490 _convF64[0] = value; | 3485 _convF64[0] = value; |
3491 _typedData._setUint64(_offset + byteOffset, _byteSwap64(_convU64[0])); | 3486 _typedData._setUint64(_offset + byteOffset, _byteSwap64(_convU64[0])); |
3492 } | 3487 } |
3493 | 3488 |
3494 Float32x4 getFloat32x4(int byteOffset, | 3489 Float32x4 getFloat32x4(int byteOffset, |
3495 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3490 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3496 if (byteOffset < 0 || byteOffset + 3 >= length) { | 3491 if (byteOffset < 0 || byteOffset + 3 >= length) { |
3497 throw _newRangeError(byteOffset + 3, length); | 3492 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); |
3498 } | 3493 } |
3499 // TODO(johnmccutchan) : Need to resolve this for endianity. | 3494 // TODO(johnmccutchan) : Need to resolve this for endianity. |
3500 return _typedData._getFloat32x4(_offset + byteOffset); | 3495 return _typedData._getFloat32x4(_offset + byteOffset); |
3501 } | 3496 } |
3502 void setFloat32x4(int byteOffset, | 3497 void setFloat32x4(int byteOffset, |
3503 Float32x4 value, | 3498 Float32x4 value, |
3504 [Endianness endian = Endianness.BIG_ENDIAN]) { | 3499 [Endianness endian = Endianness.BIG_ENDIAN]) { |
3505 if (byteOffset < 0 || byteOffset + 3 >= length) { | 3500 if (byteOffset < 0 || byteOffset + 3 >= length) { |
3506 throw _newRangeError(byteOffset + 3, length); | 3501 throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset"); |
3507 } | 3502 } |
3508 // TODO(johnmccutchan) : Need to resolve this for endianity. | 3503 // TODO(johnmccutchan) : Need to resolve this for endianity. |
3509 _typedData._setFloat32x4(_offset + byteOffset, value); | 3504 _typedData._setFloat32x4(_offset + byteOffset, value); |
3510 | 3505 |
3511 } | 3506 } |
3512 | 3507 |
3513 final TypedData _typedData; | 3508 final TypedData _typedData; |
3514 final int _offset; | 3509 final int _offset; |
3515 final int length; | 3510 final int length; |
3516 } | 3511 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3614 } | 3609 } |
3615 } | 3610 } |
3616 | 3611 |
3617 | 3612 |
3618 int _defaultIfNull(object, value) { | 3613 int _defaultIfNull(object, value) { |
3619 if (object == null) { | 3614 if (object == null) { |
3620 return value; | 3615 return value; |
3621 } | 3616 } |
3622 return object; | 3617 return object; |
3623 } | 3618 } |
3624 | |
3625 | |
3626 _newRangeError(int index, int length) { | |
3627 String message = "$index must be in the range [0..$length)"; | |
3628 return new RangeError(message); | |
3629 } | |
OLD | NEW |