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 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 2982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2993 } | 2993 } |
2994 | 2994 |
2995 int get lengthInBytes { | 2995 int get lengthInBytes { |
2996 return length; | 2996 return length; |
2997 } | 2997 } |
2998 | 2998 |
2999 int get offsetInBytes { | 2999 int get offsetInBytes { |
3000 return _offset; | 3000 return _offset; |
3001 } | 3001 } |
3002 | 3002 |
3003 int get elementSizeInBytes { | |
Ivan Posva
2013/11/05 19:15:28
I don't think this belongs here.
Ivan Posva
2013/11/05 19:18:13
Never mind, mixed up ByteBuffer and ByteData.
| |
3004 return 1; | |
3005 } | |
3006 | |
3003 // Method(s) implementing ByteData interface. | 3007 // Method(s) implementing ByteData interface. |
3004 | 3008 |
3005 int getInt8(int byteOffset) { | 3009 int getInt8(int byteOffset) { |
3006 if (byteOffset < 0 || byteOffset >= length) { | 3010 if (byteOffset < 0 || byteOffset >= length) { |
3007 _throwRangeError(byteOffset, length); | 3011 _throwRangeError(byteOffset, length); |
3008 } | 3012 } |
3009 return _typedData._getInt8(_offset + byteOffset); | 3013 return _typedData._getInt8(_offset + byteOffset); |
3010 } | 3014 } |
3011 void setInt8(int byteOffset, int value) { | 3015 void setInt8(int byteOffset, int value) { |
3012 if (byteOffset < 0 || byteOffset >= length) { | 3016 if (byteOffset < 0 || byteOffset >= length) { |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3341 return value; | 3345 return value; |
3342 } | 3346 } |
3343 return object; | 3347 return object; |
3344 } | 3348 } |
3345 | 3349 |
3346 | 3350 |
3347 void _throwRangeError(int index, int length) { | 3351 void _throwRangeError(int index, int length) { |
3348 String message = "$index must be in the range [0..$length)"; | 3352 String message = "$index must be in the range [0..$length)"; |
3349 throw new RangeError(message); | 3353 throw new RangeError(message); |
3350 } | 3354 } |
OLD | NEW |