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
OpenDAS
dlib
Commits
0b82d5ea
"git@developer.sourcefind.cn:OpenDAS/dlib.git" did not exist on "9a336696104834d836812037f43489b0d36f51ea"
Commit
0b82d5ea
authored
May 20, 2012
by
Davis King
Browse files
A minor change to avoid warnings about violation of string aliasing rules.
parent
371e3f39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
dlib/test/graph_cuts.cpp
dlib/test/graph_cuts.cpp
+6
-1
No files found.
dlib/test/graph_cuts.cpp
View file @
0b82d5ea
...
@@ -838,7 +838,12 @@ namespace
...
@@ -838,7 +838,12 @@ namespace
value_type
factor_value
(
unsigned
long
idx
)
const
value_type
factor_value
(
unsigned
long
idx
)
const
{
{
return
((
double
)
murmur_hash3
(
&
idx
,
sizeof
(
idx
),
seed
)
-
std
::
numeric_limits
<
uint32
>::
max
()
/
2.0
)
/
1000.0
;
// Copy idx into a char buffer to avoid warnings about violation of strict aliasing
// rules when murmur_hash3() gets inlined into this function.
char
buf
[
sizeof
(
idx
)];
memcpy
(
buf
,
&
idx
,
sizeof
(
idx
));
// now hash the buffer rather than idx.
return
((
double
)
murmur_hash3
(
buf
,
sizeof
(
buf
),
seed
)
-
std
::
numeric_limits
<
uint32
>::
max
()
/
2.0
)
/
1000.0
;
}
}
value_type
factor_value_disagreement
(
unsigned
long
idx1
,
unsigned
long
idx2
)
const
value_type
factor_value_disagreement
(
unsigned
long
idx1
,
unsigned
long
idx2
)
const
...
...
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