Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
0a868641
There was an error fetching the commit references. Please try again later.
Commit
0a868641
authored
6 years ago
by
Lioncash
Browse files
Options
Downloads
Patches
Plain Diff
common/swap: Use static_cast where applicable
parent
1edf4dd7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/swap.h
+16
-16
16 additions, 16 deletions
src/common/swap.h
with
16 additions
and
16 deletions
src/common/swap.h
+
16
−
16
View file @
0a868641
...
...
@@ -185,39 +185,39 @@ public:
template
<
typename
S
>
swapped_t
&
operator
=
(
const
S
&
source
)
{
value
=
swap
(
(
T
)
source
);
value
=
swap
(
static_cast
<
T
>
(
source
)
)
;
return
*
this
;
}
operator
s8
()
const
{
return
(
s8
)
swap
();
return
static_cast
<
s8
>
(
swap
()
)
;
}
operator
u8
()
const
{
return
(
u8
)
swap
();
return
static_cast
<
u8
>
(
swap
()
)
;
}
operator
s16
()
const
{
return
(
s16
)
swap
();
return
static_cast
<
s16
>
(
swap
()
)
;
}
operator
u16
()
const
{
return
(
u16
)
swap
();
return
static_cast
<
u16
>
(
swap
()
)
;
}
operator
s32
()
const
{
return
(
s32
)
swap
();
return
static_cast
<
s32
>
(
swap
()
)
;
}
operator
u32
()
const
{
return
(
u32
)
swap
();
return
static_cast
<
u32
>
(
swap
()
)
;
}
operator
s64
()
const
{
return
(
s64
)
swap
();
return
static_cast
<
s64
>
(
swap
()
)
;
}
operator
u64
()
const
{
return
(
u64
)
swap
();
return
static_cast
<
u64
>
(
swap
()
)
;
}
operator
float
()
const
{
return
(
float
)
swap
();
return
static_cast
<
float
>
(
swap
()
)
;
}
operator
double
()
const
{
return
(
double
)
swap
();
return
static_cast
<
double
>
(
swap
()
)
;
}
// +v
...
...
@@ -253,7 +253,7 @@ public:
}
template
<
typename
S
>
swapped_t
operator
+
(
const
S
&
i
)
const
{
return
swap
()
+
(
T
)
i
;
return
swap
()
+
static_cast
<
T
>
(
i
)
;
}
// v - 5
swapped_t
operator
-
(
const
swapped_t
&
i
)
const
{
...
...
@@ -261,7 +261,7 @@ public:
}
template
<
typename
S
>
swapped_t
operator
-
(
const
S
&
i
)
const
{
return
swap
()
-
(
T
)
i
;
return
swap
()
-
static_cast
<
T
>
(
i
)
;
}
// v += 5
...
...
@@ -271,7 +271,7 @@ public:
}
template
<
typename
S
>
swapped_t
&
operator
+=
(
const
S
&
i
)
{
value
=
swap
(
swap
()
+
(
T
)
i
);
value
=
swap
(
swap
()
+
static_cast
<
T
>
(
i
)
);
return
*
this
;
}
// v -= 5
...
...
@@ -281,7 +281,7 @@ public:
}
template
<
typename
S
>
swapped_t
&
operator
-=
(
const
S
&
i
)
{
value
=
swap
(
swap
()
-
(
T
)
i
);
value
=
swap
(
swap
()
-
static_cast
<
T
>
(
i
)
);
return
*
this
;
}
...
...
@@ -541,7 +541,7 @@ S operator&(const S& i, const swap_struct_t<T, F> v) {
template
<
typename
S
,
typename
T
,
typename
F
>
S
operator
&
(
const
swap_struct_t
<
T
,
F
>
v
,
const
S
&
i
)
{
return
(
S
)
(
v
.
swap
()
&
i
);
return
static_cast
<
S
>
(
v
.
swap
()
&
i
);
}
// Comparaison
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment