Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
81add96b
Commit
81add96b
authored
Aug 11, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Fix bug in get_uint64
parent
020e66b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
src/util.cc
src/util.cc
+1
-1
src/util_test.cc
src/util_test.cc
+14
-4
No files found.
src/util.cc
View file @
81add96b
...
...
@@ -1158,7 +1158,7 @@ uint64_t get_uint64(const uint8_t *data) {
n
+=
static_cast
<
uint64_t
>
(
data
[
1
])
<<
48
;
n
+=
static_cast
<
uint64_t
>
(
data
[
2
])
<<
40
;
n
+=
static_cast
<
uint64_t
>
(
data
[
3
])
<<
32
;
n
+=
data
[
4
]
<<
24
;
n
+=
static_cast
<
uint64_t
>
(
data
[
4
])
<<
24
;
n
+=
data
[
5
]
<<
16
;
n
+=
data
[
6
]
<<
8
;
n
+=
data
[
7
];
...
...
src/util_test.cc
View file @
81add96b
...
...
@@ -394,12 +394,22 @@ void test_util_localtime_date(void) {
}
void
test_util_get_uint64
(
void
)
{
auto
v
=
std
::
array
<
unsigned
char
,
8
>
{
{
0x01
,
0x12
,
0x34
,
0x56
,
0x78
,
0x9a
,
0xab
,
0xbc
}};
{
auto
v
=
std
::
array
<
unsigned
char
,
8
>
{
{
0x01
,
0x12
,
0x34
,
0x56
,
0xff
,
0x9a
,
0xab
,
0xbc
}};
auto
n
=
util
::
get_uint64
(
v
.
data
());
CU_ASSERT
(
0x01123456ff9aabbcULL
==
n
);
}
{
auto
v
=
std
::
array
<
unsigned
char
,
8
>
{
{
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
,
0xff
}};
auto
n
=
util
::
get_uint64
(
v
.
data
());
auto
n
=
util
::
get_uint64
(
v
.
data
());
CU_ASSERT
(
0x01123456789aabbcULL
==
n
);
CU_ASSERT
(
0xffffffffffffffffULL
==
n
);
}
}
}
// namespace shrpx
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