Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have the TermList default constructor zero-initialise #541

Merged
merged 3 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Indexing/TermSharing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ void TermSharing::computeAndSetSharedTermData(Term* t)
}
else
{
ASS(tt->isTerm());
ASS_REP(tt->term()->shared(), tt->term()->toString());

Term* r = tt->term();
Expand Down
14 changes: 7 additions & 7 deletions Kernel/Term.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,8 @@ enum ArgumentOrderVals {
*/
class TermList {
public:
// divide by 4 because of the tag, by 2 to split the space evenly
static const unsigned SPEC_UPPER_BOUND = (UINT_MAX / 4) / 2;
/** dummy constructor, does nothing */
TermList() = default;
/* default constructor, satisfying isEmpty() */
TermList() : _content(FUN) {}
/** creates a term list containing a pointer to a term */
explicit TermList(Term* t) : _content(0) {
// NB we also zero-initialise _content so that the spare bits are zero on 32-bit platforms
Expand Down Expand Up @@ -142,7 +140,7 @@ class TermList {
/** the term contains an ordinary variable as its head */
inline bool isOrdinaryVar() const { return tag() == ORD_VAR; }
/** the term contains a special variable as its head */
inline bool isSpecialVar() const { return tag() == SPEC_VAR && var() < SPEC_UPPER_BOUND; }
inline bool isSpecialVar() const { return tag() == SPEC_VAR; }

/** return the variable number */
inline unsigned var() const
Expand Down Expand Up @@ -177,9 +175,11 @@ class TermList {
/** make the term into a special variable with a given number */
inline void makeSpecialVar(unsigned vnumber)
{ _content = vnumber * 4 + SPEC_VAR; }
/** create an term empty (so that isEmpty() returns true) */
/** create an term empty (so that isEmpty() returns true)
* (can just be the default constructor now)
*/
inline static TermList empty()
{ TermList out; out._content = FUN; return out; }
{ return TermList(); }
/** the top of a term is either a function symbol or a variable id. this class is model this */
class Top {
using Inner = Coproduct<unsigned, unsigned>;
Expand Down