Chromium Code Reviews| Index: runtime/vm/object.h |
| diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
| index a81aaa05a37bbc548f7dadf2e98b2bf88b881ce6..beb4fafad9c8af1f8e3f4e78f5bb1bf38151d593 100644 |
| --- a/runtime/vm/object.h |
| +++ b/runtime/vm/object.h |
| @@ -5034,6 +5034,11 @@ class TypedData : public Instance { |
| return ElementSizeInBytes(cid); |
| } |
| + intptr_t ElementType() const { |
| + intptr_t cid = raw()->GetClassId(); |
| + return ElementType(cid); |
|
kustermann
2013/04/16 17:26:04
It is not the nicest thing that these functions re
Vyacheslav Egorov (Google)
2013/04/17 11:41:56
Why not introduce an enum:
enum TypeDataElementTy
Vyacheslav Egorov (Google)
2013/04/17 12:55:27
I meant:
enum TypeDataElementType {
#define V(nam
kustermann
2013/04/18 13:57:57
Done.
|
| + } |
| + |
| intptr_t LengthInBytes() const { |
| intptr_t cid = raw()->GetClassId(); |
| return (ElementSizeInBytes(cid) * Length()); |
| @@ -5086,6 +5091,11 @@ class TypedData : public Instance { |
| return element_size[class_id - kTypedDataInt8ArrayCid]; |
| } |
| + static intptr_t ElementType(intptr_t class_id) { |
| + ASSERT(RawObject::IsTypedDataClassId(class_id)); |
| + return class_id - kTypedDataInt8ArrayCid; |
| + } |
| + |
| static intptr_t MaxElements(intptr_t class_id) { |
| ASSERT(RawObject::IsTypedDataClassId(class_id)); |
| return (kSmiMax / ElementSizeInBytes(class_id)); |
| @@ -5134,6 +5144,11 @@ class ExternalTypedData : public Instance { |
| return ElementSizeInBytes(cid); |
| } |
| + intptr_t ElementType() const { |
| + intptr_t cid = raw()->GetClassId(); |
| + return ElementType(cid); |
| + } |
| + |
| intptr_t LengthInBytes() const { |
| intptr_t cid = raw()->GetClassId(); |
| return (ElementSizeInBytes(cid) * Length()); |
| @@ -5187,6 +5202,11 @@ class ExternalTypedData : public Instance { |
| return TypedData::element_size[class_id - kExternalTypedDataInt8ArrayCid]; |
| } |
| + static intptr_t ElementType(intptr_t class_id) { |
| + ASSERT(RawObject::IsExternalTypedDataClassId(class_id)); |
| + return class_id - kExternalTypedDataInt8ArrayCid; |
| + } |
| + |
| static intptr_t MaxElements(intptr_t class_id) { |
| ASSERT(RawObject::IsExternalTypedDataClassId(class_id)); |
| return (kSmiMax / ElementSizeInBytes(class_id)); |