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

Unified Diff: runtime/vm/raw_object.h

Issue 2005723004: Fraction class prototype and test (not to be committed). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: work in progress Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/parser_test.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object.h
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 3f5a507d3a67dc74476be205e77057f4a596ccf5..296f21a682f6d12222ac1c28983c7e60d74337b6 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -61,6 +61,7 @@ namespace dart {
V(Smi) \
V(Mint) \
V(Bigint) \
+ V(Fraction) \
V(Double) \
V(Bool) \
V(GrowableObjectArray) \
@@ -1805,6 +1806,20 @@ class RawBigint : public RawInteger {
};
+class RawFraction : public RawNumber {
+ RAW_HEAP_OBJECT_IMPLEMENTATION(Fraction);
+
+ RawObject** from() {
+ return reinterpret_cast<RawObject**>(&ptr()->numerator_);
+ }
+ RawInteger* numerator_;
+ RawInteger* denominator_;
+ RawObject** to() {
+ return reinterpret_cast<RawObject**>(&ptr()->denominator_);
+ }
+};
+
+
class RawDouble : public RawNumber {
RAW_HEAP_OBJECT_IMPLEMENTATION(Double);
@@ -2237,7 +2252,8 @@ inline bool RawObject::IsNumberClassId(intptr_t index) {
kSmiCid == kNumberCid + 2 &&
kMintCid == kNumberCid + 3 &&
kBigintCid == kNumberCid + 4 &&
- kDoubleCid == kNumberCid + 5);
+ kFractionCid == kNumberCid + 5 &&
+ kDoubleCid == kNumberCid + 6);
return (index >= kNumberCid && index < kBoolCid);
}
@@ -2247,8 +2263,8 @@ inline bool RawObject::IsIntegerClassId(intptr_t index) {
COMPILE_ASSERT(kSmiCid == kIntegerCid + 1 &&
kMintCid == kIntegerCid + 2 &&
kBigintCid == kIntegerCid + 3 &&
- kDoubleCid == kIntegerCid + 4);
- return (index >= kIntegerCid && index < kDoubleCid);
+ kFractionCid == kIntegerCid + 4);
+ return (index >= kIntegerCid && index < kFractionCid);
}
@@ -2416,7 +2432,7 @@ inline bool RawObject::IsVariableSizeClassId(intptr_t index) {
// is defined by the VM but are used in the VM code by computing the
// implicit field offsets of the various fields in the dart object.
inline bool RawObject::IsImplicitFieldClassId(intptr_t index) {
- return (IsTypedDataViewClassId(index) || index == kByteBufferCid);
+ return (IsTypedDataViewClassId(index) || (index == kByteBufferCid));
}
« no previous file with comments | « runtime/vm/parser_test.cc ('k') | runtime/vm/raw_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698