mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
complete migration of ZAM to use only public ZVal methods
This commit is contained in:
parent
1457099df3
commit
3e1b536810
2 changed files with 7 additions and 8 deletions
|
@ -161,7 +161,6 @@ union ZVal {
|
||||||
private:
|
private:
|
||||||
friend class RecordVal;
|
friend class RecordVal;
|
||||||
friend class VectorVal;
|
friend class VectorVal;
|
||||||
friend class zeek::detail::ZBody;
|
|
||||||
|
|
||||||
// Used for bool, int, enum.
|
// Used for bool, int, enum.
|
||||||
zeek_int_t int_val;
|
zeek_int_t int_val;
|
||||||
|
|
|
@ -133,8 +133,8 @@ eval GenInits()
|
||||||
ConstructRecordPost($$)
|
ConstructRecordPost($$)
|
||||||
|
|
||||||
macro SetUpRecFieldOps(lhs_full, rhs_full, which_lhs_map)
|
macro SetUpRecFieldOps(lhs_full, rhs_full, which_lhs_map)
|
||||||
auto lhs = lhs_full.record_val;
|
auto lhs = lhs_full.AsRecordRef();
|
||||||
auto rhs = rhs_full.record_val;
|
auto rhs = rhs_full.AsRecord();
|
||||||
auto& lhs_map = Z_AUX->which_lhs_map;
|
auto& lhs_map = Z_AUX->which_lhs_map;
|
||||||
auto& rhs_map = Z_AUX->rhs_map;
|
auto& rhs_map = Z_AUX->rhs_map;
|
||||||
auto n = rhs_map.size();
|
auto n = rhs_map.size();
|
||||||
|
@ -186,14 +186,14 @@ op1-read
|
||||||
class VV
|
class VV
|
||||||
eval SetUpRecFieldOps($1, $2, map)
|
eval SetUpRecFieldOps($1, $2, map)
|
||||||
for ( size_t i = 0U; i < n; ++i )
|
for ( size_t i = 0U; i < n; ++i )
|
||||||
lhs->RawField(lhs_map[i]).int_val += rhs->RawField(rhs_map[i]).int_val;
|
lhs->RawField(lhs_map[i]).AsIntRef() += rhs->RawField(rhs_map[i]).AsInt();
|
||||||
|
|
||||||
op Rec-Add-Double-Fields
|
op Rec-Add-Double-Fields
|
||||||
op1-read
|
op1-read
|
||||||
class VV
|
class VV
|
||||||
eval SetUpRecFieldOps($1, $2, map)
|
eval SetUpRecFieldOps($1, $2, map)
|
||||||
for ( size_t i = 0U; i < n; ++i )
|
for ( size_t i = 0U; i < n; ++i )
|
||||||
lhs->RawField(lhs_map[i]).double_val += rhs->RawField(rhs_map[i]).double_val;
|
lhs->RawField(lhs_map[i]).AsDoubleRef() += rhs->RawField(rhs_map[i]).AsDouble();
|
||||||
|
|
||||||
op Rec-Add-Fields
|
op Rec-Add-Fields
|
||||||
op1-read
|
op1-read
|
||||||
|
@ -206,11 +206,11 @@ eval SetUpRecFieldOps($1, $2, map)
|
||||||
auto rhs_i = rhs->RawField(rhs_map[i]);
|
auto rhs_i = rhs->RawField(rhs_map[i]);
|
||||||
auto tag = types[i]->Tag();
|
auto tag = types[i]->Tag();
|
||||||
if ( tag == TYPE_INT )
|
if ( tag == TYPE_INT )
|
||||||
lhs_i.int_val += rhs_i.int_val;
|
lhs_i.AsIntRef() += rhs_i.AsInt();
|
||||||
else if ( tag == TYPE_COUNT )
|
else if ( tag == TYPE_COUNT )
|
||||||
lhs_i.uint_val += rhs_i.uint_val;
|
lhs_i.AsCountRef() += rhs_i.AsCount();
|
||||||
else
|
else
|
||||||
lhs_i.double_val += rhs_i.double_val;
|
lhs_i.AsDoubleRef() += rhs_i.AsDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
# Special instruction for concretizing vectors that are fields in a
|
# Special instruction for concretizing vectors that are fields in a
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue