Changeset - r27988:da4727e3cf61
[Not reviewed]
master
0 1 0
Peter Nelson - 14 months ago 2023-10-09 12:11:55
peter1138@openttd.org
Codechange: Don't use bit-field in Yapf rail node. (#11362)

Compacting 3 booleans into 3 bits could save memory allocation, however this data is inside a union which also contains a 4-byte integer. As such this gives the cost penalty of a bit-field without any benefit.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/pathfinder/yapf/yapf_node_rail.hpp
Show inline comments
 
@@ -127,9 +127,9 @@ struct CYapfRailNodeT
 
	union {
 
		uint32_t          m_inherited_flags;
 
		struct {
 
			bool          m_targed_seen : 1;
 
			bool          m_choice_seen : 1;
 
			bool          m_last_signal_was_red : 1;
 
			bool          m_targed_seen;
 
			bool          m_choice_seen;
 
			bool          m_last_signal_was_red;
 
		} flags_s;
 
	} flags_u;
 
	SignalType        m_last_red_signal_type;
0 comments (0 inline, 0 general)