SCI: Added operator== and !=, as well as an isNull method to reg_t

svn-id: r40356
This commit is contained in:
Max Horn 2009-05-06 11:07:04 +00:00
parent b7d1ca00d7
commit 8d2f80fd51
2 changed files with 15 additions and 4 deletions

View file

@ -39,7 +39,7 @@
namespace Sci { namespace Sci {
reg_t NULL_REG = NULL_REG_INITIALIZER; reg_t NULL_REG = {0, 0};
//#define VM_DEBUG_SEND //#define VM_DEBUG_SEND
#undef STRICT_SEND // Disallows variable sends with more than one parameter #undef STRICT_SEND // Disallows variable sends with more than one parameter

View file

@ -36,6 +36,18 @@ typedef int SegmentId;
struct reg_t { struct reg_t {
uint16 segment; uint16 segment;
uint16 offset; uint16 offset;
bool isNull() const {
return !(offset || segment);
}
bool operator==(const reg_t &x) const {
return (offset == x.offset) && (segment == x.segment);
}
bool operator!=(const reg_t &x) const {
return (offset != x.offset) || (segment != x.segment);
}
}; };
#define PREG "%04x:%04x" #define PREG "%04x:%04x"
@ -61,9 +73,8 @@ static inline reg_t make_reg(int segment, int offset) {
return r; return r;
} }
#define IS_NULL_REG(r) (!((r).offset || (r).segment)) #define IS_NULL_REG(r) ((r).isNull())
#define REG_EQ(a, b) (((a).offset == (b).offset) && ((a).segment == (b).segment)) #define REG_EQ(a, b) ((a) == (b))
#define NULL_REG_INITIALIZER {0, 0}
extern reg_t NULL_REG; extern reg_t NULL_REG;
} // End of namespace Sci } // End of namespace Sci