Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fuchsia.googlesource.com-third_party-google-double-conversion
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
fuchsia-mirror
fuchsia.googlesource.com-third_party-google-double-conversion
Commits
9a8e518b
Unverified
Commit
9a8e518b
authored
6 years ago
by
Florian Loitsch
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #68 from floitschG/static_size_assert
Use `static_assert` with newer compilers.
parents
ae9ad905
da420c34
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
double-conversion/utils.h
+6
-8
6 additions, 8 deletions
double-conversion/utils.h
with
6 additions
and
8 deletions
double-conversion/utils.h
+
6
−
8
View file @
9a8e518b
...
...
@@ -93,12 +93,6 @@ inline void abort_noreturn() { abort(); }
#error Target architecture was not detected as supported by Double-Conversion.
#endif
#if defined(__GNUC__)
#define DOUBLE_CONVERSION_UNUSED __attribute__((unused))
#else
#define DOUBLE_CONVERSION_UNUSED
#endif
#if defined(_WIN32) && !defined(__MINGW32__)
typedef
signed
char
int8_t
;
...
...
@@ -325,8 +319,12 @@ template <class Dest, class Source>
inline
Dest
BitCast
(
const
Source
&
source
)
{
// Compile time assertion: sizeof(Dest) == sizeof(Source)
// A compile error here means your Dest and Source have different sizes.
DOUBLE_CONVERSION_UNUSED
typedef
char
VerifySizesAreEqual
[
sizeof
(
Dest
)
==
sizeof
(
Source
)
?
1
:
-
1
];
#if __cplusplus >= 201103L
static_assert
(
sizeof
(
Dest
)
==
sizeof
(
Source
),
"source and destination size mismatch"
);
#else
typedef
char
VerifySizesAreEqual
[
sizeof
(
Dest
)
==
sizeof
(
Source
)
?
1
:
-
1
];
#endif
Dest
dest
;
memmove
(
&
dest
,
&
source
,
sizeof
(
dest
));
...
...
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