Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
3dfa0c7f
Commit
3dfa0c7f
authored
Feb 10, 2017
by
Francis Dupont
Browse files
[master] Merged trac5091 (writeInt g++ bug)
parents
995f389a
931db903
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/dhcp/tests/option_custom_unittest.cc
View file @
3dfa0c7f
...
...
@@ -99,9 +99,24 @@ public:
/// @tparam integer type.
template
<
typename
T
>
void
writeInt
(
T
value
,
std
::
vector
<
uint8_t
>&
buf
)
{
// This loop is incorrectly compiled by some old g++?!
for
(
int
i
=
0
;
i
<
sizeof
(
T
);
++
i
)
{
buf
.
push_back
(
value
>>
((
sizeof
(
T
)
-
i
-
1
)
*
8
)
&
0xFF
);
switch
(
sizeof
(
T
))
{
case
4
:
buf
.
push_back
((
value
>>
24
)
&
0xFF
);
/* falls into */
case
3
:
buf
.
push_back
((
value
>>
16
)
&
0xFF
);
/* falls into */
case
2
:
buf
.
push_back
((
value
>>
8
)
&
0xFF
);
/* falls into */
case
1
:
buf
.
push_back
(
value
&
0xFF
);
break
;
default:
// This loop is incorrectly compiled by some old g++?!
for
(
int
i
=
0
;
i
<
sizeof
(
T
);
++
i
)
{
buf
.
push_back
(
value
>>
((
sizeof
(
T
)
-
i
-
1
)
*
8
)
&
0xFF
);
}
}
}
...
...
src/lib/dhcp/tests/option_data_types_unittest.cc
View file @
3dfa0c7f
...
...
@@ -44,9 +44,24 @@ public:
/// @tparam integer type.
template
<
typename
T
>
void
writeInt
(
T
value
,
std
::
vector
<
uint8_t
>&
buf
)
{
// This loop is incorrectly compiled by some old g++?!
for
(
int
i
=
0
;
i
<
sizeof
(
T
);
++
i
)
{
buf
.
push_back
(
value
>>
((
sizeof
(
T
)
-
i
-
1
)
*
8
)
&
0xFF
);
switch
(
sizeof
(
T
))
{
case
4
:
buf
.
push_back
((
value
>>
24
)
&
0xFF
);
/* falls into */
case
3
:
buf
.
push_back
((
value
>>
16
)
&
0xFF
);
/* falls into */
case
2
:
buf
.
push_back
((
value
>>
8
)
&
0xFF
);
/* falls into */
case
1
:
buf
.
push_back
(
value
&
0xFF
);
break
;
default:
// This loop is incorrectly compiled by some old g++?!
for
(
int
i
=
0
;
i
<
sizeof
(
T
);
++
i
)
{
buf
.
push_back
(
value
>>
((
sizeof
(
T
)
-
i
-
1
)
*
8
)
&
0xFF
);
}
}
}
...
...
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