Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit42dfacf

Browse files
2.1.1
* removed `std::aligned_storage<>`
1 parentcc59b15 commit42dfacf

File tree

10 files changed

+82
-34
lines changed

10 files changed

+82
-34
lines changed

‎development/ffsm2/detail/containers/task_list.hpp‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct TaskT final
4747
: TaskBase
4848
{
4949
using Payload = TPayload;
50-
using Storage =typename std::aligned_storage<sizeof(Payload),2>::type;
50+
using Storage =uint8_t[sizeof(Payload)];
5151

5252
using TaskBase::TaskBase;
5353

@@ -70,7 +70,17 @@ struct TaskT final
7070

7171
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7272

73-
Storage storage;
73+
#ifdef _MSC_VER
74+
#pragma warning(push)
75+
#pragma warning(disable: 4324)// structure was padded due to alignment specifier
76+
#endif
77+
78+
alignas(Payload) Storage storage {};
79+
80+
#ifdef _MSC_VER
81+
#pragma warning(pop)
82+
#endif
83+
7484
bool payloadSet =false;
7585
};
7686

‎development/ffsm2/detail/features/common.hpp‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ stateName(const std::type_index stateType)noexcept{
4949

5050
#if defined(_MSC_VER)
5151

52-
auto first =
52+
Short first =
5353
raw[0] =='s' ?7 :// Struct
5454
raw[0] =='c' ?6 :// Class
5555
0;
@@ -113,7 +113,7 @@ namespace detail {
113113
#pragma warning(disable: 4324)// structure was padded due to alignment specifier
114114
#endif
115115

116-
structalignas(4)TransitionBase {
116+
structTransitionBase {
117117
FFSM2_CONSTEXPR(11)
118118
TransitionBase()noexcept =default;
119119

@@ -183,11 +183,11 @@ struct alignas(4) TransitionBase {
183183
////////////////////////////////////////////////////////////////////////////////
184184

185185
template<typename TPayload>
186-
structalignas(4)TransitionTfinal
186+
structTransitionTfinal
187187
: TransitionBase
188188
{
189189
using Payload = TPayload;
190-
using Storage =typename std::aligned_storage<sizeof(Payload),4>::type;
190+
using Storage =uint8_t[sizeof(Payload)];
191191

192192
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
193193

@@ -254,14 +254,24 @@ struct alignas(4) TransitionT final
254254

255255
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
256256

257+
#ifdef _MSC_VER
258+
#pragma warning(push)
259+
#pragma warning(disable: 4324)// structure was padded due to alignment specifier
260+
#endif
261+
262+
alignas(Payload) Storage storage {};
263+
264+
#ifdef _MSC_VER
265+
#pragma warning(pop)
266+
#endif
267+
257268
bool payloadSet =false;
258-
Storage storage;
259269
};
260270

261271
//------------------------------------------------------------------------------
262272

263273
template<>
264-
structalignas(4)TransitionT<void>final
274+
structTransitionT<void>final
265275
: TransitionBase
266276
{
267277
using TransitionBase::TransitionBase;

‎development/ffsm2/detail/root.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class R_ {
152152

153153
/// @brief Access plan
154154
/// @return Plan
155-
FFSM2_CONSTEXPR(14) Plan plan()noexcept{return Plan{_core.planData};}
155+
FFSM2_CONSTEXPR(14)Plan plan()noexcept{return Plan{_core.planData};}
156156

157157
/// @brief Access read-only plan
158158
/// @return Read-only plan

‎development/ffsm2/detail/root/plan.inl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,12 @@ PlanBaseT<TArgs>::linkTask(const Long index) noexcept{
203203
FFSM2_ASSERT(_bounds.first < TaskLinks::CAPACITY);
204204
FFSM2_ASSERT(_bounds.last < TaskLinks::CAPACITY);
205205

206-
auto& lastLink = _planData.taskLinks[_bounds.last];
206+
TaskLink& lastLink = _planData.taskLinks[_bounds.last];
207207
FFSM2_ASSERT(lastLink.next == INVALID_LONG);
208208

209209
lastLink.next = index;
210210

211-
auto& currLink = _planData.taskLinks[index];
211+
TaskLink& currLink = _planData.taskLinks[index];
212212
FFSM2_ASSERT(currLink.prev == INVALID_LONG);
213213

214214
currLink.prev = _bounds.last;
@@ -236,7 +236,7 @@ PlanBaseT<TArgs>::clearTasks() noexcept{
236236
{
237237
FFSM2_ASSERT(index < TaskLinks::CAPACITY);
238238

239-
constauto& link = _planData.taskLinks[index];
239+
constTaskLink& link = _planData.taskLinks[index];
240240
FFSM2_ASSERT(index == _bounds.first ?
241241
link.prev == INVALID_LONG :
242242
link.prev < TaskLinks::CAPACITY);

‎development/ffsm2/detail/root/plan_data.inl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ PlanDataT<ArgsT<TC, TG, TSL FFSM2_IF_SERIALIZATION(, NSB), NSL, NTC, TTP>>::veri
107107
if (bounds.first != INVALID_LONG) {
108108
FFSM2_ASSERT(bounds.last != INVALID_LONG);
109109

110-
for (auto slow = bounds.first, fast = slow; ; ) {
110+
for (Long slow = bounds.first, fast = slow; ; ) {
111111
++length;
112112
const TaskLink& task = taskLinks[slow];
113113

‎development/ffsm2/detail/structure/composite.hpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ struct FFSM2_EMPTY_BASES C_
2424
using PlanControl= PlanControlT <Args>;
2525
using ScopedRegion=typename PlanControl::Region;
2626

27+
#if FFSM2_PLANS_AVAILABLE()
28+
using Plan=typename PlanControl::Plan;
29+
#endif
30+
2731
using FullControl= FullControlT <Args>;
2832
using ControlLock=typename FullControl::Lock;
2933

‎development/ffsm2/detail/structure/composite.inl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ C_<TA, TH, TS...>::deepExit(PlanControl& control) noexcept {
281281
active = INVALID_SHORT;
282282

283283
#if FFSM2_PLANS_AVAILABLE()
284-
auto plan = control.plan();
284+
Plan plan = control.plan();
285285
plan.clear();
286286
#endif
287287
}

‎development/ffsm2/detail/structure/state.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ template <StateID NStateId,
1717
structS_
1818
: THead
1919
{
20-
staticconstexprauto STATE_ID = NStateId;
20+
staticconstexprStateID STATE_ID = NStateId;
2121

2222
using Context=typename TArgs::Context;
2323

‎development/ffsm2/machine_dev.hpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// FFSM2 (flat state machine for games and interactive applications)
2-
// 2.1.0 (2022-08-13)
2+
// 2.1.1 (2022-08-15)
33
//
44
// Created by Andrew Gresyk
55
//
@@ -33,7 +33,7 @@
3333

3434
#defineFFSM2_VERSION_MAJOR2
3535
#defineFFSM2_VERSION_MINOR1
36-
#defineFFSM2_VERSION_PATCH0
36+
#defineFFSM2_VERSION_PATCH1
3737

3838
#defineFFSM2_VERSION (10000 * FFSM2_VERSION_MAJOR +100 * FFSM2_VERSION_MINOR + FFSM2_VERSION_PATCH)
3939

‎include/ffsm2/machine.hpp‎

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// FFSM2 (flat state machine for games and interactive applications)
2-
// 2.1.0 (2022-08-13)
2+
// 2.1.1 (2022-08-15)
33
//
44
// Created by Andrew Gresyk
55
//
@@ -33,7 +33,7 @@
3333

3434
#defineFFSM2_VERSION_MAJOR2
3535
#defineFFSM2_VERSION_MINOR1
36-
#defineFFSM2_VERSION_PATCH0
36+
#defineFFSM2_VERSION_PATCH1
3737

3838
#defineFFSM2_VERSION (10000 * FFSM2_VERSION_MAJOR +100 * FFSM2_VERSION_MINOR + FFSM2_VERSION_PATCH)
3939

@@ -959,7 +959,7 @@ stateName(const std::type_index stateType)noexcept{
959959

960960
#if defined(_MSC_VER)
961961

962-
auto first =
962+
Short first =
963963
raw[0] =='s' ?7 :// Struct
964964
raw[0] =='c' ?6 :// Class
965965
0;
@@ -1016,7 +1016,7 @@ namespace detail {
10161016
#pragma warning(disable: 4324)// structure was padded due to alignment specifier
10171017
#endif
10181018

1019-
structalignas(4)TransitionBase {
1019+
structTransitionBase {
10201020
FFSM2_CONSTEXPR(11)
10211021
TransitionBase()noexcept =default;
10221022

@@ -1070,11 +1070,11 @@ struct alignas(4) TransitionBase {
10701070
#endif
10711071

10721072
template<typename TPayload>
1073-
structalignas(4)TransitionTfinal
1073+
structTransitionTfinal
10741074
: TransitionBase
10751075
{
10761076
using Payload = TPayload;
1077-
using Storage =typename std::aligned_storage<sizeof(Payload),4>::type;
1077+
using Storage =uint8_t[sizeof(Payload)];
10781078

10791079
using TransitionBase::TransitionBase;
10801080

@@ -1125,12 +1125,22 @@ struct alignas(4) TransitionT final
11251125
reinterpret_cast<const Payload*>(&storage) :nullptr;
11261126
}
11271127

1128+
#ifdef _MSC_VER
1129+
#pragma warning(push)
1130+
#pragma warning(disable: 4324)// structure was padded due to alignment specifier
1131+
#endif
1132+
1133+
alignas(Payload) Storage storage {};
1134+
1135+
#ifdef _MSC_VER
1136+
#pragma warning(pop)
1137+
#endif
1138+
11281139
bool payloadSet =false;
1129-
Storage storage;
11301140
};
11311141

11321142
template<>
1133-
structalignas(4)TransitionT<void>final
1143+
structTransitionT<void>final
11341144
: TransitionBase
11351145
{
11361146
using TransitionBase::TransitionBase;
@@ -1596,7 +1606,7 @@ struct TaskT final
15961606
: TaskBase
15971607
{
15981608
using Payload = TPayload;
1599-
using Storage =typename std::aligned_storage<sizeof(Payload),2>::type;
1609+
using Storage =uint8_t[sizeof(Payload)];
16001610

16011611
using TaskBase::TaskBase;
16021612

@@ -1613,7 +1623,17 @@ struct TaskT final
16131623
new (&storage) Payload{payload};
16141624
}
16151625

1616-
Storage storage;
1626+
#ifdef _MSC_VER
1627+
#pragma warning(push)
1628+
#pragma warning(disable: 4324)// structure was padded due to alignment specifier
1629+
#endif
1630+
1631+
alignas(Payload) Storage storage {};
1632+
1633+
#ifdef _MSC_VER
1634+
#pragma warning(pop)
1635+
#endif
1636+
16171637
bool payloadSet =false;
16181638
};
16191639

@@ -2106,7 +2126,7 @@ PlanDataT<ArgsT<TC, TG, TSL FFSM2_IF_SERIALIZATION(, NSB), NSL, NTC, TTP>>::veri
21062126
if (bounds.first != INVALID_LONG) {
21072127
FFSM2_ASSERT(bounds.last != INVALID_LONG);
21082128

2109-
for (auto slow = bounds.first, fast = slow; ; ) {
2129+
for (Long slow = bounds.first, fast = slow; ; ) {
21102130
++length;
21112131
const TaskLink& task = taskLinks[slow];
21122132

@@ -2712,12 +2732,12 @@ PlanBaseT<TArgs>::linkTask(const Long index) noexcept{
27122732
FFSM2_ASSERT(_bounds.first < TaskLinks::CAPACITY);
27132733
FFSM2_ASSERT(_bounds.last < TaskLinks::CAPACITY);
27142734

2715-
auto& lastLink = _planData.taskLinks[_bounds.last];
2735+
TaskLink& lastLink = _planData.taskLinks[_bounds.last];
27162736
FFSM2_ASSERT(lastLink.next == INVALID_LONG);
27172737

27182738
lastLink.next = index;
27192739

2720-
auto& currLink = _planData.taskLinks[index];
2740+
TaskLink& currLink = _planData.taskLinks[index];
27212741
FFSM2_ASSERT(currLink.prev == INVALID_LONG);
27222742

27232743
currLink.prev = _bounds.last;
@@ -2743,7 +2763,7 @@ PlanBaseT<TArgs>::clearTasks() noexcept{
27432763
{
27442764
FFSM2_ASSERT(index < TaskLinks::CAPACITY);
27452765

2746-
constauto& link = _planData.taskLinks[index];
2766+
constTaskLink& link = _planData.taskLinks[index];
27472767
FFSM2_ASSERT(index == _bounds.first ?
27482768
link.prev == INVALID_LONG :
27492769
link.prev < TaskLinks::CAPACITY);
@@ -4201,7 +4221,7 @@ template <StateID NStateId,
42014221
structS_
42024222
: THead
42034223
{
4204-
staticconstexprauto STATE_ID = NStateId;
4224+
staticconstexprStateID STATE_ID = NStateId;
42054225

42064226
using Context=typename TArgs::Context;
42074227

@@ -5339,6 +5359,10 @@ struct FFSM2_EMPTY_BASES C_
53395359
using PlanControl= PlanControlT <Args>;
53405360
using ScopedRegion=typename PlanControl::Region;
53415361

5362+
#if FFSM2_PLANS_AVAILABLE()
5363+
using Plan=typename PlanControl::Plan;
5364+
#endif
5365+
53425366
using FullControl= FullControlT <Args>;
53435367
using ControlLock=typename FullControl::Lock;
53445368

@@ -5663,7 +5687,7 @@ C_<TA, TH, TS...>::deepExit(PlanControl& control) noexcept {
56635687
active = INVALID_SHORT;
56645688

56655689
#if FFSM2_PLANS_AVAILABLE()
5666-
auto plan = control.plan();
5690+
Plan plan = control.plan();
56675691
plan.clear();
56685692
#endif
56695693
}
@@ -5976,7 +6000,7 @@ class R_ {
59766000

59776001
/// @brief Access plan
59786002
/// @return Plan
5979-
FFSM2_CONSTEXPR(14) Plan plan()noexcept{return Plan{_core.planData};}
6003+
FFSM2_CONSTEXPR(14)Plan plan()noexcept{return Plan{_core.planData};}
59806004

59816005
/// @brief Access read-only plan
59826006
/// @return Read-only plan

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp