about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-08-20 10:19:45 -0700
committerBrian Anderson <banderson@mozilla.com>2011-08-20 10:19:45 -0700
commit2c54b464080f0f4cb42fd712e10657a1d100735f (patch)
tree254264371e81334cfd08a855fb84588215bcacba
parentd09b421d55d3772516181cfa5b791be485389876 (diff)
downloadrust-2c54b464080f0f4cb42fd712e10657a1d100735f.tar.gz
rust-2c54b464080f0f4cb42fd712e10657a1d100735f.zip
Revert "Shuffle around definitions in rust_shape.h"
This reverts commit d09b421d55d3772516181cfa5b791be485389876.
-rw-r--r--src/rt/rust_shape.h220
1 files changed, 110 insertions, 110 deletions
diff --git a/src/rt/rust_shape.h b/src/rt/rust_shape.h
index f21e6d68ca7..d0e72005a34 100644
--- a/src/rt/rust_shape.h
+++ b/src/rt/rust_shape.h
@@ -244,116 +244,6 @@ struct type_param {
 };
 
 
-// Pointer wrappers for data traversals
-
-class ptr {
-private:
-    uint8_t *p;
-
-public:
-    template<typename T>
-    struct data { typedef T t; };
-
-    ptr(uint8_t *in_p)
-    : p(in_p) {}
-
-    ptr(uintptr_t in_p)
-    : p((uint8_t *)in_p) {}
-
-    inline ptr operator+(const size_t amount) const {
-        return make(p + amount);
-    }
-    inline ptr &operator+=(const size_t amount) { p += amount; return *this; }
-    inline bool operator<(const ptr other) { return p < other.p; }
-    inline ptr operator++() { ptr rv(*this); p++; return rv; }
-    inline uint8_t operator*() { return *p; }
-
-    template<typename T>
-    inline operator T *() { return (T *)p; }
-
-    inline operator uintptr_t() { return (uintptr_t)p; }
-
-    static inline ptr make(uint8_t *in_p) {
-        ptr self(in_p);
-        return self;
-    }
-};
-
-template<typename T>
-static inline T
-bump_dp(ptr &dp) {
-    T x = *((T *)dp);
-    dp += sizeof(T);
-    return x;
-}
-
-template<typename T>
-static inline T
-get_dp(ptr dp) {
-    return *((T *)dp);
-}
-
-
-// Pointer pairs for structural comparison
-
-template<typename T>
-class data_pair {
-public:
-    T fst, snd;
-
-    data_pair() {}
-    data_pair(T &in_fst, T &in_snd) : fst(in_fst), snd(in_snd) {}
-
-    inline void operator=(const T rhs) { fst = snd = rhs; }
-
-    static data_pair<T> make(T &fst, T &snd) {
-        data_pair<T> data(fst, snd);
-        return data;
-    }
-};
-
-class ptr_pair {
-public:
-    uint8_t *fst, *snd;
-
-    template<typename T>
-    struct data { typedef data_pair<T> t; };
-
-    ptr_pair(uint8_t *in_fst, uint8_t *in_snd) : fst(in_fst), snd(in_snd) {}
-
-    ptr_pair(data_pair<uint8_t *> &other) : fst(other.fst), snd(other.snd) {}
-
-    inline void operator=(uint8_t *rhs) { fst = snd = rhs; }
-
-    inline ptr_pair operator+(size_t n) const {
-        return make(fst + n, snd + n);
-    }
-
-    inline ptr_pair operator+=(size_t n) {
-        fst += n; snd += n;
-        return *this;
-    }
-
-    inline ptr_pair operator-(size_t n) const {
-        return make(fst - n, snd - n);
-    }
-
-    inline bool operator<(const ptr_pair &other) const {
-        return fst < other.fst && snd < other.snd;
-    }
-
-    static inline ptr_pair make(uint8_t *fst, uint8_t *snd) {
-        ptr_pair self(fst, snd);
-        return self;
-    }
-
-    static inline ptr_pair make(const data_pair<uint8_t *> &pair) {
-        ptr_pair self(pair.fst, pair.snd);
-        return self;
-    }
-};
-
-
 // Traversals
 
 #define WALK_NUMBER(c_type) \
@@ -665,6 +555,116 @@ public:
     }
 };
 
+
+// Pointer wrappers for data traversals
+
+class ptr {
+private:
+    uint8_t *p;
+
+public:
+    template<typename T>
+    struct data { typedef T t; };
+
+    ptr(uint8_t *in_p)
+    : p(in_p) {}
+
+    ptr(uintptr_t in_p)
+    : p((uint8_t *)in_p) {}
+
+    inline ptr operator+(const size_t amount) const {
+        return make(p + amount);
+    }
+    inline ptr &operator+=(const size_t amount) { p += amount; return *this; }
+    inline bool operator<(const ptr other) { return p < other.p; }
+    inline ptr operator++() { ptr rv(*this); p++; return rv; }
+    inline uint8_t operator*() { return *p; }
+
+    template<typename T>
+    inline operator T *() { return (T *)p; }
+
+    inline operator uintptr_t() { return (uintptr_t)p; }
+
+    static inline ptr make(uint8_t *in_p) {
+        ptr self(in_p);
+        return self;
+    }
+};
+
+template<typename T>
+static inline T
+bump_dp(ptr &dp) {
+    T x = *((T *)dp);
+    dp += sizeof(T);
+    return x;
+}
+
+template<typename T>
+static inline T
+get_dp(ptr dp) {
+    return *((T *)dp);
+}
+
+
+// Pointer pairs for structural comparison
+
+template<typename T>
+class data_pair {
+public:
+    T fst, snd;
+
+    data_pair() {}
+    data_pair(T &in_fst, T &in_snd) : fst(in_fst), snd(in_snd) {}
+
+    inline void operator=(const T rhs) { fst = snd = rhs; }
+
+    static data_pair<T> make(T &fst, T &snd) {
+        data_pair<T> data(fst, snd);
+        return data;
+    }
+};
+
+class ptr_pair {
+public:
+    uint8_t *fst, *snd;
+
+    template<typename T>
+    struct data { typedef data_pair<T> t; };
+
+    ptr_pair(uint8_t *in_fst, uint8_t *in_snd) : fst(in_fst), snd(in_snd) {}
+
+    ptr_pair(data_pair<uint8_t *> &other) : fst(other.fst), snd(other.snd) {}
+
+    inline void operator=(uint8_t *rhs) { fst = snd = rhs; }
+
+    inline ptr_pair operator+(size_t n) const {
+        return make(fst + n, snd + n);
+    }
+
+    inline ptr_pair operator+=(size_t n) {
+        fst += n; snd += n;
+        return *this;
+    }
+
+    inline ptr_pair operator-(size_t n) const {
+        return make(fst - n, snd - n);
+    }
+
+    inline bool operator<(const ptr_pair &other) const {
+        return fst < other.fst && snd < other.snd;
+    }
+
+    static inline ptr_pair make(uint8_t *fst, uint8_t *snd) {
+        ptr_pair self(fst, snd);
+        return self;
+    }
+
+    static inline ptr_pair make(const data_pair<uint8_t *> &pair) {
+        ptr_pair self(pair.fst, pair.snd);
+        return self;
+    }
+};
+
 }   // end namespace shape