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

Unified Diff: runtime/vm/growable_array.h

Issue 26294002: Cleanups: int -> intptr_t for "array" lengths, memory sizes. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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/flow_graph_inliner.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/growable_array.h
===================================================================
--- runtime/vm/growable_array.h (revision 28314)
+++ runtime/vm/growable_array.h (working copy)
@@ -23,7 +23,7 @@
ASSERT(zone_ != NULL);
}
- BaseGrowableArray(int initial_capacity, Zone* zone)
+ BaseGrowableArray(intptr_t initial_capacity, Zone* zone)
: length_(0), capacity_(0), data_(NULL), zone_(zone) {
ASSERT(zone_ != NULL);
if (initial_capacity > 0) {
@@ -32,7 +32,7 @@
}
}
- int length() const { return length_; }
+ intptr_t length() const { return length_; }
T* data() const { return data_; }
bool is_empty() const { return length_ == 0; }
@@ -53,7 +53,7 @@
return result;
}
- T& operator[](int index) const {
+ T& operator[](intptr_t index) const {
ASSERT(0 <= index);
ASSERT(index < length_);
ASSERT(length_ <= capacity_);
@@ -87,12 +87,12 @@
inline void Sort(int compare(const T*, const T*));
private:
- int length_;
- int capacity_;
+ intptr_t length_;
+ intptr_t capacity_;
T* data_;
Zone* zone_; // Zone in which we are allocating the array.
- void Resize(int new_length);
+ void Resize(intptr_t new_length);
DISALLOW_COPY_AND_ASSIGN(BaseGrowableArray);
};
@@ -107,9 +107,9 @@
template<typename T, typename B>
-void BaseGrowableArray<T, B>::Resize(int new_length) {
+void BaseGrowableArray<T, B>::Resize(intptr_t new_length) {
if (new_length > capacity_) {
- int new_capacity = Utils::RoundUpToPowerOfTwo(new_length);
+ intptr_t new_capacity = Utils::RoundUpToPowerOfTwo(new_length);
T* new_data = zone_->Realloc<T>(data_, capacity_, new_capacity);
ASSERT(new_data != NULL);
data_ = new_data;
@@ -122,7 +122,7 @@
template<typename T>
class GrowableArray : public BaseGrowableArray<T, ValueObject> {
public:
- explicit GrowableArray(int initial_capacity)
+ explicit GrowableArray(intptr_t initial_capacity)
: BaseGrowableArray<T, ValueObject>(
initial_capacity,
Isolate::Current()->current_zone()) {}
@@ -135,7 +135,7 @@
template<typename T>
class ZoneGrowableArray : public BaseGrowableArray<T, ZoneAllocated> {
public:
- explicit ZoneGrowableArray(int initial_capacity)
+ explicit ZoneGrowableArray(intptr_t initial_capacity)
: BaseGrowableArray<T, ZoneAllocated>(
initial_capacity,
Isolate::Current()->current_zone()) {}
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698