mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-16 07:28:52 +00:00
Update skeleton
This commit is contained in:
@@ -573,6 +573,15 @@ impl Dtype {
|
||||
);
|
||||
|
||||
let fields = fields.unwrap();
|
||||
if fields.is_empty() {
|
||||
return Ok(Self::Struct {
|
||||
name,
|
||||
fields: Some(fields),
|
||||
is_const,
|
||||
size_align_offsets: Some((0, 1, Vec::new())),
|
||||
});
|
||||
}
|
||||
|
||||
let align_of = fields
|
||||
.iter()
|
||||
.map(|f| f.deref().size_align_of(structs))
|
||||
@@ -709,6 +718,7 @@ impl Dtype {
|
||||
Self::Unit { .. } => todo!(),
|
||||
Self::Int { .. } => true,
|
||||
Self::Float { .. } => true,
|
||||
Self::Pointer { .. } => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -644,13 +644,28 @@ mod calculator {
|
||||
|
||||
calculate_float_binary_operator_expression(op, lhs, rhs, lhs_w)
|
||||
}
|
||||
(Value::Pointer { bid, .. }, Value::Pointer { bid: other_bid, .. }) => match op {
|
||||
(
|
||||
Value::Pointer { bid, offset, .. },
|
||||
Value::Pointer {
|
||||
bid: other_bid,
|
||||
offset: other_offset,
|
||||
..
|
||||
},
|
||||
) => match op {
|
||||
ast::BinaryOperator::Equals => {
|
||||
let result = if bid == other_bid { 1 } else { 0 };
|
||||
let result = if bid == other_bid && offset == other_offset {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
};
|
||||
Ok(Value::int(result, 1, false))
|
||||
}
|
||||
ast::BinaryOperator::NotEquals => {
|
||||
let result = if bid != other_bid { 1 } else { 0 };
|
||||
let result = if !(bid == other_bid && offset == other_offset) {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
};
|
||||
Ok(Value::int(result, 1, false))
|
||||
}
|
||||
_ => todo!(
|
||||
|
||||
Reference in New Issue
Block a user