Ignore:
Timestamp:
Mar 8, 2018, 1:37:46 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
28bc8c8
Parents:
f1f8e55
Message:

Update all benchmarks to match new CFA

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/general/evaluation/object.hpp

    rf1f8e55 rfb2ce27  
    6767};
    6868
    69 class boolean : public ordered, public printable {
    70         bool x;
    71 public:
    72         boolean() = default;
    73         boolean(bool x) : x(x) {}
    74         boolean(const boolean&) = default;
    75         boolean(boolean&&) = default;
    76         ptr<object> new_inst() const override { return make<boolean>(); }
    77         ptr<object> new_copy() const override { return make<boolean>(*this); }
    78         boolean& operator= (const boolean& that) {
    79                 x = that.x;
    80                 return *this;   
    81         }
    82         object& operator= (const object& that) override { return *this = that.as<boolean>(); } /***/
    83         boolean& operator= (boolean&&) = default;
    84         ~boolean() override = default;
    85 
    86         int cmp(const boolean& that) const { return x == that.x ? 0 : x == false ? -1 : 1; }
    87         int cmp(const ordered& that) const override { return cmp( that.as<boolean>() ); } /***/
    88 
    89         void print(std::ostream& out) const override { out << (x ? "true" : "false"); }
    90 };
    91 
    9269class character : public ordered, public printable {
    9370        char x;
     
    11693};
    11794
     95class short_integer : public ordered, public printable {
     96        short x;
     97public:
     98        short_integer() = default;
     99        short_integer(short x) : x(x) {}
     100        short_integer(const short_integer&) = default;
     101        short_integer(short_integer&&) = default;
     102        ptr<object> new_inst() const override { return make<short_integer>(); }
     103        ptr<object> new_copy() const override { return make<short_integer>(*this); }
     104        short_integer& operator= (const short_integer& that) {
     105                x = that.x;
     106                return *this;   
     107        }
     108        object& operator= (const object& that) override { return *this = that.as<short_integer>(); } /***/
     109        short_integer& operator= (short_integer&&) = default;
     110        ~short_integer() override = default;
     111
     112        int cmp(const short_integer& that) const { return x == that.x ? 0 : x < that.x ? -1 : 1; }
     113        int cmp(const ordered& that) const override { return cmp( that.as<short_integer>() ); } /***/
     114
     115        void print(std::ostream& out) const override { out << x; }
     116};
     117
    118118class integer : public ordered, public printable {
    119119        int x;
     
    137137
    138138        void print(std::ostream& out) const override { out << x; }
    139 };
    140 
    141 class c_string : public printable {
    142         static constexpr const char* empty = "";
    143         const char* s;
    144 public:
    145         c_string() : s(empty) {}
    146         c_string(const char* s) : s(s) {}
    147         c_string(const c_string&) = default;
    148         c_string(c_string&&) = default;
    149         ptr<object> new_inst() const override { return make<c_string>(); }
    150         ptr<object> new_copy() const override { return make<c_string>(s); }
    151         c_string& operator= (const c_string& that) {
    152                 s = that.s;
    153                 return *this;
    154         }
    155         object& operator= (const object& that) override { return *this = that.as<c_string>(); } /***/
    156         c_string& operator= (c_string&&) = default;
    157         ~c_string() override = default;
    158 
    159         void print(std::ostream& out) const override { out << s; }
    160139};
    161140
     
    188167                return y->as<ordered>().cmp( that.y->as<ordered>() ); /***/
    189168        }
    190         int cmp(const ordered& that) const override { return cmp( that.as<pair>() ); }
     169        int cmp(const ordered& that) const override { return cmp( that.as<pair>() ); } /***/
    191170
    192171        void print(std::ostream& out) const override {
Note: See TracChangeset for help on using the changeset viewer.