Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: runtime/lib/typed_data.dart

Issue 23686003: Add alignment checks to typed_data views (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 patch class Int8List { 7 patch class Int8List {
8 /* patch */ factory Int8List(int length) { 8 /* patch */ factory Int8List(int length) {
9 return new _Int8Array(length); 9 return new _Int8Array(length);
10 } 10 }
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 class _Int8ArrayView extends _TypedListView implements Int8List { 2174 class _Int8ArrayView extends _TypedListView implements Int8List {
2175 // Constructor. 2175 // Constructor.
2176 _Int8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2176 _Int8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2177 : super(buffer, _offsetInBytes, 2177 : super(buffer, _offsetInBytes,
2178 _defaultIfNull(_length, 2178 _defaultIfNull(_length,
2179 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2179 ((buffer.lengthInBytes - _offsetInBytes) ~/
2180 Int8List.BYTES_PER_ELEMENT))) { 2180 Int8List.BYTES_PER_ELEMENT))) {
2181 _rangeCheck(buffer.lengthInBytes, 2181 _rangeCheck(buffer.lengthInBytes,
2182 _offsetInBytes, 2182 _offsetInBytes,
2183 length * Int8List.BYTES_PER_ELEMENT); 2183 length * Int8List.BYTES_PER_ELEMENT);
2184 _offsetAlignmentCheck(_offsetInBytes, Int8List.BYTES_PER_ELEMENT);
siva 2013/08/29 16:30:16 int8, uint8 and uint8 clamped do not need any alig
Cutch 2013/09/08 13:16:36 Done.
2184 } 2185 }
2185 2186
2186 2187
2187 // Method(s) implementing List interface. 2188 // Method(s) implementing List interface.
2188 2189
2189 int operator[](int index) { 2190 int operator[](int index) {
2190 if (index < 0 || index >= length) { 2191 if (index < 0 || index >= length) {
2191 _throwRangeError(index, length); 2192 _throwRangeError(index, length);
2192 } 2193 }
2193 return _typedData._getInt8(offsetInBytes + 2194 return _typedData._getInt8(offsetInBytes +
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2225 class _Uint8ArrayView extends _TypedListView implements Uint8List { 2226 class _Uint8ArrayView extends _TypedListView implements Uint8List {
2226 // Constructor. 2227 // Constructor.
2227 _Uint8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2228 _Uint8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2228 : super(buffer, _offsetInBytes, 2229 : super(buffer, _offsetInBytes,
2229 _defaultIfNull(_length, 2230 _defaultIfNull(_length,
2230 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2231 ((buffer.lengthInBytes - _offsetInBytes) ~/
2231 Uint8List.BYTES_PER_ELEMENT))) { 2232 Uint8List.BYTES_PER_ELEMENT))) {
2232 _rangeCheck(buffer.lengthInBytes, 2233 _rangeCheck(buffer.lengthInBytes,
2233 _offsetInBytes, 2234 _offsetInBytes,
2234 length * Uint8List.BYTES_PER_ELEMENT); 2235 length * Uint8List.BYTES_PER_ELEMENT);
2236 _offsetAlignmentCheck(_offsetInBytes, Uint8List.BYTES_PER_ELEMENT);
siva 2013/08/29 16:30:16 see comment above.
Cutch 2013/09/08 13:16:36 Done.
2235 } 2237 }
2236 2238
2237 2239
2238 // Method(s) implementing List interface. 2240 // Method(s) implementing List interface.
2239 2241
2240 int operator[](int index) { 2242 int operator[](int index) {
2241 if (index < 0 || index >= length) { 2243 if (index < 0 || index >= length) {
2242 _throwRangeError(index, length); 2244 _throwRangeError(index, length);
2243 } 2245 }
2244 return _typedData._getUint8(offsetInBytes + 2246 return _typedData._getUint8(offsetInBytes +
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 // Constructor. 2279 // Constructor.
2278 _Uint8ClampedArrayView(ByteBuffer buffer, 2280 _Uint8ClampedArrayView(ByteBuffer buffer,
2279 [int _offsetInBytes = 0, int _length]) 2281 [int _offsetInBytes = 0, int _length])
2280 : super(buffer, _offsetInBytes, 2282 : super(buffer, _offsetInBytes,
2281 _defaultIfNull(_length, 2283 _defaultIfNull(_length,
2282 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2284 ((buffer.lengthInBytes - _offsetInBytes) ~/
2283 Uint8List.BYTES_PER_ELEMENT))) { 2285 Uint8List.BYTES_PER_ELEMENT))) {
2284 _rangeCheck(buffer.lengthInBytes, 2286 _rangeCheck(buffer.lengthInBytes,
2285 offsetInBytes, 2287 offsetInBytes,
2286 length * Uint8List.BYTES_PER_ELEMENT); 2288 length * Uint8List.BYTES_PER_ELEMENT);
2289 _offsetAlignmentCheck(_offsetInBytes, Uint8List.BYTES_PER_ELEMENT);
siva 2013/08/29 16:30:16 Ditto.
Cutch 2013/09/08 13:16:36 Done.
2287 } 2290 }
2288 2291
2289 2292
2290 // Method(s) implementing List interface. 2293 // Method(s) implementing List interface.
2291 2294
2292 int operator[](int index) { 2295 int operator[](int index) {
2293 if (index < 0 || index >= length) { 2296 if (index < 0 || index >= length) {
2294 _throwRangeError(index, length); 2297 _throwRangeError(index, length);
2295 } 2298 }
2296 return _typedData._getUint8(offsetInBytes + 2299 return _typedData._getUint8(offsetInBytes +
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 class _Int16ArrayView extends _TypedListView implements Int16List { 2331 class _Int16ArrayView extends _TypedListView implements Int16List {
2329 // Constructor. 2332 // Constructor.
2330 _Int16ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2333 _Int16ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2331 : super(buffer, _offsetInBytes, 2334 : super(buffer, _offsetInBytes,
2332 _defaultIfNull(_length, 2335 _defaultIfNull(_length,
2333 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2336 ((buffer.lengthInBytes - _offsetInBytes) ~/
2334 Int16List.BYTES_PER_ELEMENT))) { 2337 Int16List.BYTES_PER_ELEMENT))) {
2335 _rangeCheck(buffer.lengthInBytes, 2338 _rangeCheck(buffer.lengthInBytes,
2336 offsetInBytes, 2339 offsetInBytes,
2337 length * Int16List.BYTES_PER_ELEMENT); 2340 length * Int16List.BYTES_PER_ELEMENT);
2341 _offsetAlignmentCheck(_offsetInBytes, Int16List.BYTES_PER_ELEMENT);
2338 } 2342 }
2339 2343
2340 2344
2341 // Method(s) implementing List interface. 2345 // Method(s) implementing List interface.
2342 2346
2343 int operator[](int index) { 2347 int operator[](int index) {
2344 if (index < 0 || index >= length) { 2348 if (index < 0 || index >= length) {
2345 _throwRangeError(index, length); 2349 _throwRangeError(index, length);
2346 } 2350 }
2347 return _typedData._getInt16(offsetInBytes + 2351 return _typedData._getInt16(offsetInBytes +
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 class _Uint16ArrayView extends _TypedListView implements Uint16List { 2383 class _Uint16ArrayView extends _TypedListView implements Uint16List {
2380 // Constructor. 2384 // Constructor.
2381 _Uint16ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2385 _Uint16ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2382 : super(buffer, _offsetInBytes, 2386 : super(buffer, _offsetInBytes,
2383 _defaultIfNull(_length, 2387 _defaultIfNull(_length,
2384 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2388 ((buffer.lengthInBytes - _offsetInBytes) ~/
2385 Uint16List.BYTES_PER_ELEMENT))) { 2389 Uint16List.BYTES_PER_ELEMENT))) {
2386 _rangeCheck(buffer.lengthInBytes, 2390 _rangeCheck(buffer.lengthInBytes,
2387 offsetInBytes, 2391 offsetInBytes,
2388 length * Uint16List.BYTES_PER_ELEMENT); 2392 length * Uint16List.BYTES_PER_ELEMENT);
2393 _offsetAlignmentCheck(_offsetInBytes, Uint16List.BYTES_PER_ELEMENT);
2389 } 2394 }
2390 2395
2391 2396
2392 // Method(s) implementing List interface. 2397 // Method(s) implementing List interface.
2393 2398
2394 int operator[](int index) { 2399 int operator[](int index) {
2395 if (index < 0 || index >= length) { 2400 if (index < 0 || index >= length) {
2396 _throwRangeError(index, length); 2401 _throwRangeError(index, length);
2397 } 2402 }
2398 return _typedData._getUint16(offsetInBytes + 2403 return _typedData._getUint16(offsetInBytes +
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 class _Int32ArrayView extends _TypedListView implements Int32List { 2435 class _Int32ArrayView extends _TypedListView implements Int32List {
2431 // Constructor. 2436 // Constructor.
2432 _Int32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2437 _Int32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2433 : super(buffer, _offsetInBytes, 2438 : super(buffer, _offsetInBytes,
2434 _defaultIfNull(_length, 2439 _defaultIfNull(_length,
2435 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2440 ((buffer.lengthInBytes - _offsetInBytes) ~/
2436 Int32List.BYTES_PER_ELEMENT))) { 2441 Int32List.BYTES_PER_ELEMENT))) {
2437 _rangeCheck(buffer.lengthInBytes, 2442 _rangeCheck(buffer.lengthInBytes,
2438 offsetInBytes, 2443 offsetInBytes,
2439 length * Int32List.BYTES_PER_ELEMENT); 2444 length * Int32List.BYTES_PER_ELEMENT);
2445 _offsetAlignmentCheck(_offsetInBytes, Int32List.BYTES_PER_ELEMENT);
2440 } 2446 }
2441 2447
2442 2448
2443 // Method(s) implementing List interface. 2449 // Method(s) implementing List interface.
2444 2450
2445 int operator[](int index) { 2451 int operator[](int index) {
2446 if (index < 0 || index >= length) { 2452 if (index < 0 || index >= length) {
2447 _throwRangeError(index, length); 2453 _throwRangeError(index, length);
2448 } 2454 }
2449 return _typedData._getInt32(offsetInBytes + 2455 return _typedData._getInt32(offsetInBytes +
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2481 class _Uint32ArrayView extends _TypedListView implements Uint32List { 2487 class _Uint32ArrayView extends _TypedListView implements Uint32List {
2482 // Constructor. 2488 // Constructor.
2483 _Uint32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2489 _Uint32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2484 : super(buffer, _offsetInBytes, 2490 : super(buffer, _offsetInBytes,
2485 _defaultIfNull(_length, 2491 _defaultIfNull(_length,
2486 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2492 ((buffer.lengthInBytes - _offsetInBytes) ~/
2487 Uint32List.BYTES_PER_ELEMENT))) { 2493 Uint32List.BYTES_PER_ELEMENT))) {
2488 _rangeCheck(buffer.lengthInBytes, 2494 _rangeCheck(buffer.lengthInBytes,
2489 offsetInBytes, 2495 offsetInBytes,
2490 length * Uint32List.BYTES_PER_ELEMENT); 2496 length * Uint32List.BYTES_PER_ELEMENT);
2497 _offsetAlignmentCheck(_offsetInBytes, Uint32List.BYTES_PER_ELEMENT);
2491 } 2498 }
2492 2499
2493 2500
2494 // Method(s) implementing List interface. 2501 // Method(s) implementing List interface.
2495 2502
2496 int operator[](int index) { 2503 int operator[](int index) {
2497 if (index < 0 || index >= length) { 2504 if (index < 0 || index >= length) {
2498 _throwRangeError(index, length); 2505 _throwRangeError(index, length);
2499 } 2506 }
2500 return _typedData._getUint32(offsetInBytes + 2507 return _typedData._getUint32(offsetInBytes +
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2532 class _Int64ArrayView extends _TypedListView implements Int64List { 2539 class _Int64ArrayView extends _TypedListView implements Int64List {
2533 // Constructor. 2540 // Constructor.
2534 _Int64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2541 _Int64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2535 : super(buffer, _offsetInBytes, 2542 : super(buffer, _offsetInBytes,
2536 _defaultIfNull(_length, 2543 _defaultIfNull(_length,
2537 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2544 ((buffer.lengthInBytes - _offsetInBytes) ~/
2538 Int64List.BYTES_PER_ELEMENT))) { 2545 Int64List.BYTES_PER_ELEMENT))) {
2539 _rangeCheck(buffer.lengthInBytes, 2546 _rangeCheck(buffer.lengthInBytes,
2540 offsetInBytes, 2547 offsetInBytes,
2541 length * Int64List.BYTES_PER_ELEMENT); 2548 length * Int64List.BYTES_PER_ELEMENT);
2549 _offsetAlignmentCheck(_offsetInBytes, Int64List.BYTES_PER_ELEMENT);
2542 } 2550 }
2543 2551
2544 2552
2545 // Method(s) implementing List interface. 2553 // Method(s) implementing List interface.
2546 2554
2547 int operator[](int index) { 2555 int operator[](int index) {
2548 if (index < 0 || index >= length) { 2556 if (index < 0 || index >= length) {
2549 _throwRangeError(index, length); 2557 _throwRangeError(index, length);
2550 } 2558 }
2551 return _typedData._getInt64(offsetInBytes + 2559 return _typedData._getInt64(offsetInBytes +
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 class _Uint64ArrayView extends _TypedListView implements Uint64List { 2591 class _Uint64ArrayView extends _TypedListView implements Uint64List {
2584 // Constructor. 2592 // Constructor.
2585 _Uint64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2593 _Uint64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2586 : super(buffer, _offsetInBytes, 2594 : super(buffer, _offsetInBytes,
2587 _defaultIfNull(_length, 2595 _defaultIfNull(_length,
2588 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2596 ((buffer.lengthInBytes - _offsetInBytes) ~/
2589 Uint64List.BYTES_PER_ELEMENT))) { 2597 Uint64List.BYTES_PER_ELEMENT))) {
2590 _rangeCheck(buffer.lengthInBytes, 2598 _rangeCheck(buffer.lengthInBytes,
2591 offsetInBytes, 2599 offsetInBytes,
2592 length * Uint64List.BYTES_PER_ELEMENT); 2600 length * Uint64List.BYTES_PER_ELEMENT);
2601 _offsetAlignmentCheck(_offsetInBytes, Uint64List.BYTES_PER_ELEMENT);
2593 } 2602 }
2594 2603
2595 2604
2596 // Method(s) implementing List interface. 2605 // Method(s) implementing List interface.
2597 2606
2598 int operator[](int index) { 2607 int operator[](int index) {
2599 if (index < 0 || index >= length) { 2608 if (index < 0 || index >= length) {
2600 _throwRangeError(index, length); 2609 _throwRangeError(index, length);
2601 } 2610 }
2602 return _typedData._getUint64(offsetInBytes + 2611 return _typedData._getUint64(offsetInBytes +
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2634 class _Float32ArrayView extends _TypedListView implements Float32List { 2643 class _Float32ArrayView extends _TypedListView implements Float32List {
2635 // Constructor. 2644 // Constructor.
2636 _Float32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2645 _Float32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2637 : super(buffer, _offsetInBytes, 2646 : super(buffer, _offsetInBytes,
2638 _defaultIfNull(_length, 2647 _defaultIfNull(_length,
2639 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2648 ((buffer.lengthInBytes - _offsetInBytes) ~/
2640 Float32List.BYTES_PER_ELEMENT))) { 2649 Float32List.BYTES_PER_ELEMENT))) {
2641 _rangeCheck(buffer.lengthInBytes, 2650 _rangeCheck(buffer.lengthInBytes,
2642 offsetInBytes, 2651 offsetInBytes,
2643 length * Float32List.BYTES_PER_ELEMENT); 2652 length * Float32List.BYTES_PER_ELEMENT);
2653 _offsetAlignmentCheck(_offsetInBytes, Float32List.BYTES_PER_ELEMENT);
2644 } 2654 }
2645 2655
2646 2656
2647 // Method(s) implementing List interface. 2657 // Method(s) implementing List interface.
2648 2658
2649 double operator[](int index) { 2659 double operator[](int index) {
2650 if (index < 0 || index >= length) { 2660 if (index < 0 || index >= length) {
2651 _throwRangeError(index, length); 2661 _throwRangeError(index, length);
2652 } 2662 }
2653 return _typedData._getFloat32(offsetInBytes + 2663 return _typedData._getFloat32(offsetInBytes +
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 class _Float64ArrayView extends _TypedListView implements Float64List { 2695 class _Float64ArrayView extends _TypedListView implements Float64List {
2686 // Constructor. 2696 // Constructor.
2687 _Float64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2697 _Float64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2688 : super(buffer, _offsetInBytes, 2698 : super(buffer, _offsetInBytes,
2689 _defaultIfNull(_length, 2699 _defaultIfNull(_length,
2690 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2700 ((buffer.lengthInBytes - _offsetInBytes) ~/
2691 Float64List.BYTES_PER_ELEMENT))) { 2701 Float64List.BYTES_PER_ELEMENT))) {
2692 _rangeCheck(buffer.lengthInBytes, 2702 _rangeCheck(buffer.lengthInBytes,
2693 offsetInBytes, 2703 offsetInBytes,
2694 length * Float64List.BYTES_PER_ELEMENT); 2704 length * Float64List.BYTES_PER_ELEMENT);
2705 _offsetAlignmentCheck(_offsetInBytes, Float64List.BYTES_PER_ELEMENT);
2695 } 2706 }
2696 2707
2697 2708
2698 // Method(s) implementing List interface. 2709 // Method(s) implementing List interface.
2699 2710
2700 double operator[](int index) { 2711 double operator[](int index) {
2701 if (index < 0 || index >= length) { 2712 if (index < 0 || index >= length) {
2702 _throwRangeError(index, length); 2713 _throwRangeError(index, length);
2703 } 2714 }
2704 return _typedData._getFloat64(offsetInBytes + 2715 return _typedData._getFloat64(offsetInBytes +
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 class _Float32x4ArrayView extends _TypedListView implements Float32x4List { 2747 class _Float32x4ArrayView extends _TypedListView implements Float32x4List {
2737 // Constructor. 2748 // Constructor.
2738 _Float32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length]) 2749 _Float32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
2739 : super(buffer, _offsetInBytes, 2750 : super(buffer, _offsetInBytes,
2740 _defaultIfNull(_length, 2751 _defaultIfNull(_length,
2741 ((buffer.lengthInBytes - _offsetInBytes) ~/ 2752 ((buffer.lengthInBytes - _offsetInBytes) ~/
2742 Float32x4List.BYTES_PER_ELEMENT))) { 2753 Float32x4List.BYTES_PER_ELEMENT))) {
2743 _rangeCheck(buffer.lengthInBytes, 2754 _rangeCheck(buffer.lengthInBytes,
2744 offsetInBytes, 2755 offsetInBytes,
2745 length * Float32x4List.BYTES_PER_ELEMENT); 2756 length * Float32x4List.BYTES_PER_ELEMENT);
2757 _offsetAlignmentCheck(_offsetInBytes, Float32x4List.BYTES_PER_ELEMENT);
2746 } 2758 }
2747 2759
2748 2760
2749 // Method(s) implementing List interface. 2761 // Method(s) implementing List interface.
2750 2762
2751 Float32x4 operator[](int index) { 2763 Float32x4 operator[](int index) {
2752 if (index < 0 || index >= length) { 2764 if (index < 0 || index >= length) {
2753 _throwRangeError(index, length); 2765 _throwRangeError(index, length);
2754 } 2766 }
2755 return _typedData._getFloat32x4(offsetInBytes + 2767 return _typedData._getFloat32x4(offsetInBytes +
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
3128 } 3140 }
3129 if (start < 0) { 3141 if (start < 0) {
3130 throw new RangeError.value(start); 3142 throw new RangeError.value(start);
3131 } 3143 }
3132 if (start + length > listLength) { 3144 if (start + length > listLength) {
3133 throw new RangeError.value(start + length); 3145 throw new RangeError.value(start + length);
3134 } 3146 }
3135 } 3147 }
3136 3148
3137 3149
3150 void _offsetAlignmentCheck(int offset, int alignment) {
3151 if ((offset % alignment) != 0) {
3152 throw new RangeError('Offset ($offset) must be a multiple of '
3153 'BYTES_PER_ELEMENT ($alignment)');
3154 }
3155 }
3156
3157
3138 int _defaultIfNull(object, value) { 3158 int _defaultIfNull(object, value) {
3139 if (object == null) { 3159 if (object == null) {
3140 return value; 3160 return value;
3141 } 3161 }
3142 return object; 3162 return object;
3143 } 3163 }
3144 3164
3145 3165
3146 void _throwRangeError(int index, int length) { 3166 void _throwRangeError(int index, int length) {
3147 String message = "$index must be in the range [0..$length)"; 3167 String message = "$index must be in the range [0..$length)";
3148 throw new RangeError(message); 3168 throw new RangeError(message);
3149 } 3169 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698