Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wasm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
wasm-watermarker
Commits
21f8adee
Verified
Commit
21f8adee
authored
Dec 13, 2020
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug in function-reorder method
parent
fd77caab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
Reordering-inl.hpp
lib/kyut/Reordering-inl.hpp
+10
-2
test_Reordering.cpp
test/test_Reordering.cpp
+4
-4
No files found.
lib/kyut/Reordering-inl.hpp
View file @
21f8adee
...
@@ -26,7 +26,10 @@ namespace kyut {
...
@@ -26,7 +26,10 @@ namespace kyut {
// Sort the chunk.
// Sort the chunk.
std
::
sort
(
begin
,
end
,
less
);
std
::
sort
(
begin
,
end
,
less
);
// TODO: Assume unique
// Assume unique
end
=
safe_unique
(
begin
,
end
,
[
&
](
const
auto
&
a
,
const
auto
&
b
)
{
return
!
less
(
a
,
b
)
&&
!
less
(
a
,
b
);
});
// Embed watermark.
// Embed watermark.
const
std
::
size_t
count
=
std
::
distance
(
begin
,
end
);
const
std
::
size_t
count
=
std
::
distance
(
begin
,
end
);
...
@@ -90,7 +93,12 @@ namespace kyut {
...
@@ -90,7 +93,12 @@ namespace kyut {
return
less
(
*
a
,
*
b
);
return
less
(
*
a
,
*
b
);
});
});
// TODO: Assume unique
// Assume unique
chunk
.
erase
(
safe_unique
(
std
::
begin
(
chunk
),
std
::
end
(
chunk
),
[
&
](
const
auto
&
a
,
const
auto
&
b
)
{
return
!
less
(
*
a
,
*
b
)
&&
!
less
(
*
a
,
*
b
);
}),
std
::
end
(
chunk
));
const
auto
chunk_begin
=
std
::
begin
(
chunk
);
const
auto
chunk_begin
=
std
::
begin
(
chunk
);
const
auto
chunk_end
=
std
::
end
(
chunk
);
const
auto
chunk_end
=
std
::
end
(
chunk
);
...
...
test/test_Reordering.cpp
View file @
21f8adee
...
@@ -38,8 +38,8 @@ TEST(kyut_Reordering, embed_by_reordering) {
...
@@ -38,8 +38,8 @@ TEST(kyut_Reordering, embed_by_reordering) {
check_embed
(
"2314"
,
"
\x50
"
sv
,
20
,
4
,
"2314"
);
check_embed
(
"2314"
,
"
\x50
"
sv
,
20
,
4
,
"2314"
);
check_embed
(
"2314"
,
"
\x00
"
sv
,
20
,
4
,
"1234"
);
check_embed
(
"2314"
,
"
\x00
"
sv
,
20
,
4
,
"1234"
);
//
check_embed("1223", "\x00"sv, 20, 2, "1232");
check_embed
(
"1223"
,
"
\x00
"
sv
,
20
,
2
,
"1232"
);
//
check_embed("1223", "\x40"sv, 20, 2, "2132");
check_embed
(
"1223"
,
"
\x40
"
sv
,
20
,
2
,
"2132"
);
}
}
namespace
{
namespace
{
...
@@ -73,8 +73,8 @@ TEST(kyut_Reordering, extract_by_reordering) {
...
@@ -73,8 +73,8 @@ TEST(kyut_Reordering, extract_by_reordering) {
check_extract
(
"1324"
,
20
,
4
,
"
\x40
"
sv
);
check_extract
(
"1324"
,
20
,
4
,
"
\x40
"
sv
);
check_extract
(
"2314"
,
20
,
4
,
"
\x50
"
sv
);
check_extract
(
"2314"
,
20
,
4
,
"
\x50
"
sv
);
//
check_extract("1232", 20, 2, "\x00"sv);
check_extract
(
"1232"
,
20
,
2
,
"
\x00
"
sv
);
//
check_extract("2132", 20, 2, "\x40"sv);
check_extract
(
"2132"
,
20
,
2
,
"
\x40
"
sv
);
}
}
namespace
{
namespace
{
...
...
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