Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
675bafff
Commit
675bafff
authored
Jan 28, 2020
by
Peter W. Draper
Browse files
Merge branch 'UBsan_random' into 'master'
UBsan fix for RNG Closes
#606
See merge request
!1006
parents
9f675abe
44168020
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/random.h
View file @
675bafff
...
...
@@ -108,7 +108,7 @@ INLINE static double inl_erand48(uint16_t xsubi[3]) {
temp
.
ieee
.
negative
=
0
;
temp
.
ieee
.
exponent
=
IEEE754_DOUBLE_BIAS
;
temp
.
ieee
.
mantissa0
=
(
xsubi
[
2
]
<<
4
)
|
(
xsubi
[
1
]
>>
12
);
temp
.
ieee
.
mantissa1
=
((
xsubi
[
1
]
&
0xfff
)
<<
20
)
|
(
xsubi
[
0
]
<<
4
);
temp
.
ieee
.
mantissa1
=
((
(
uint32_t
)
xsubi
[
1
]
&
0xfff
)
<<
20
)
|
(
xsubi
[
0
]
<<
4
);
/* Please note the lower 4 bits of mantissa1 are always 0. */
return
temp
.
d
-
1
.
0
;
...
...
Write
Preview
Supports
Markdown
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