Skip to content

Commit 969291a

Browse files
committed
Invert notifications_enabled bitfield logic to save a write on each CAtom_new
1 parent 8196ead commit 969291a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

atom/src/catom.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ CAtom_new( PyTypeObject* type, PyObject* args, PyObject* kwargs )
6363
atom->slots = reinterpret_cast<PyObject**>( slots );
6464
atom->set_slot_count( count );
6565
}
66-
atom->set_notifications_enabled( true );
6766
return selfptr.release();
6867
}
6968

atom/src/catom.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace atom
2121

2222
PACK(struct CAtomInfo {
2323
uint16_t slot_count;
24-
bool notifications_enabled: 1;
24+
bool notifications_disabled: 1;
2525
bool has_guards: 1;
2626
bool has_atomref: 1;
2727
bool is_frozen: 1;
@@ -66,12 +66,12 @@ struct CAtom
6666

6767
bool get_notifications_enabled()
6868
{
69-
return info.notifications_enabled;
69+
return !info.notifications_disabled;
7070
}
7171

7272
void set_notifications_enabled( bool enabled )
7373
{
74-
info.notifications_enabled = enabled;
74+
info.notifications_disabled = !enabled;
7575
}
7676

7777
bool has_guards()

0 commit comments

Comments
 (0)