Skip to content

Commit 4fa27ed

Browse files
committed
A few optimisations
1 parent 38e5675 commit 4fa27ed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/games/gametable.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,17 @@ template <class T> class TableMixedStrategyProfileRep : public MixedStrategyProf
115115
T &value) const;
116116
//@}
117117

118+
const CartesianProductSpace &m_pureStrategies;
119+
118120
long StrategyOffset(const GameStrategy &s) const
119121
{
120-
const auto &space = this->GetSupport().GetGame()->m_pureStrategies;
121-
const auto &player = s->GetPlayer();
122-
const size_t i = player->GetNumber() - 1;
123-
return (s->GetNumber() - 1) * space.m_strides[i];
122+
return (s->GetNumber() - 1) * m_pureStrategies.m_strides[s->m_player->GetNumber() - 1];
124123
}
125124

126125
public:
127126
explicit TableMixedStrategyProfileRep(const StrategySupportProfile &p_support)
128-
: MixedStrategyProfileRep<T>(p_support)
127+
: MixedStrategyProfileRep<T>(p_support),
128+
m_pureStrategies(p_support.GetGame()->m_pureStrategies)
129129
{
130130
}
131131
~TableMixedStrategyProfileRep() override = default;

0 commit comments

Comments
 (0)