Skip to content

Commit

Permalink
Invert notifications_enabled bitfield logic to save a write on each C…
Browse files Browse the repository at this point in the history
…Atom_new
  • Loading branch information
frmdstryr committed Feb 6, 2025
1 parent 8196ead commit 969291a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion atom/src/catom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ CAtom_new( PyTypeObject* type, PyObject* args, PyObject* kwargs )
atom->slots = reinterpret_cast<PyObject**>( slots );
atom->set_slot_count( count );
}
atom->set_notifications_enabled( true );
return selfptr.release();
}

Expand Down
6 changes: 3 additions & 3 deletions atom/src/catom.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace atom

PACK(struct CAtomInfo {
uint16_t slot_count;
bool notifications_enabled: 1;
bool notifications_disabled: 1;
bool has_guards: 1;
bool has_atomref: 1;
bool is_frozen: 1;
Expand Down Expand Up @@ -66,12 +66,12 @@ struct CAtom

bool get_notifications_enabled()
{
return info.notifications_enabled;
return !info.notifications_disabled;
}

void set_notifications_enabled( bool enabled )
{
info.notifications_enabled = enabled;
info.notifications_disabled = !enabled;
}

bool has_guards()
Expand Down

0 comments on commit 969291a

Please sign in to comment.