Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
7890f721
Commit
7890f721
authored
Aug 07, 2017
by
Gennadiy Civil
Committed by
GitHub
Aug 07, 2017
Browse files
Merge pull request #1180 from aconverse/master
Use wider types to prevent unsigned overflow diagnostics
parents
eb261b4d
deb99a9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
googletest/src/gtest.cc
googletest/src/gtest.cc
+2
-1
No files found.
googletest/src/gtest.cc
View file @
7890f721
...
...
@@ -310,7 +310,8 @@ namespace internal {
// than kMaxRange.
UInt32
Random
::
Generate
(
UInt32
range
)
{
// These constants are the same as are used in glibc's rand(3).
state_
=
(
1103515245U
*
state_
+
12345U
)
%
kMaxRange
;
// Use wider types than necessary to prevent unsigned overflow diagnostics.
state_
=
static_cast
<
UInt32
>
(
1103515245ULL
*
state_
+
12345U
)
%
kMaxRange
;
GTEST_CHECK_
(
range
>
0
)
<<
"Cannot generate a number in the range [0, 0)."
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment