SCI: Added operator== and !=, as well as an isNull method to reg_t
svn-id: r40356
This commit is contained in:
parent
b7d1ca00d7
commit
8d2f80fd51
2 changed files with 15 additions and 4 deletions
|
@ -39,7 +39,7 @@
|
|||
|
||||
namespace Sci {
|
||||
|
||||
reg_t NULL_REG = NULL_REG_INITIALIZER;
|
||||
reg_t NULL_REG = {0, 0};
|
||||
|
||||
//#define VM_DEBUG_SEND
|
||||
#undef STRICT_SEND // Disallows variable sends with more than one parameter
|
||||
|
|
|
@ -36,6 +36,18 @@ typedef int SegmentId;
|
|||
struct reg_t {
|
||||
uint16 segment;
|
||||
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"
|
||||
|
@ -61,9 +73,8 @@ static inline reg_t make_reg(int segment, int offset) {
|
|||
return r;
|
||||
}
|
||||
|
||||
#define IS_NULL_REG(r) (!((r).offset || (r).segment))
|
||||
#define REG_EQ(a, b) (((a).offset == (b).offset) && ((a).segment == (b).segment))
|
||||
#define NULL_REG_INITIALIZER {0, 0}
|
||||
#define IS_NULL_REG(r) ((r).isNull())
|
||||
#define REG_EQ(a, b) ((a) == (b))
|
||||
extern reg_t NULL_REG;
|
||||
|
||||
} // End of namespace Sci
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue