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
gaoqiong
MIGraphX
Commits
e55dd8e9
Commit
e55dd8e9
authored
May 10, 2018
by
Paul
Browse files
Formatting
parent
254f187e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
include/rtg/instruction.hpp
include/rtg/instruction.hpp
+9
-8
src/program.cpp
src/program.cpp
+3
-3
No files found.
include/rtg/instruction.hpp
View file @
e55dd8e9
...
...
@@ -63,14 +63,15 @@ struct instruction
bool
valid
()
const
{
return
std
::
all_of
(
output
.
begin
(),
output
.
end
(),
[
&
](
instruction_ref
i
)
{
return
std
::
find
(
i
->
arguments
.
begin
(),
i
->
arguments
.
end
(),
*
this
)
!=
i
->
arguments
.
end
();
})
&&
std
::
all_of
(
arguments
.
begin
(),
arguments
.
end
(),
[
&
](
instruction_ref
i
)
{
return
std
::
find
(
i
->
output
.
begin
(),
i
->
output
.
end
(),
*
this
)
!=
i
->
output
.
end
();
});
return
std
::
all_of
(
output
.
begin
(),
output
.
end
(),
[
&
](
instruction_ref
i
)
{
return
std
::
find
(
i
->
arguments
.
begin
(),
i
->
arguments
.
end
(),
*
this
)
!=
i
->
arguments
.
end
();
})
&&
std
::
all_of
(
arguments
.
begin
(),
arguments
.
end
(),
[
&
](
instruction_ref
i
)
{
return
std
::
find
(
i
->
output
.
begin
(),
i
->
output
.
end
(),
*
this
)
!=
i
->
output
.
end
();
});
}
friend
bool
operator
==
(
instruction_ref
ref
,
const
instruction
&
i
)
{
return
i
==
ref
;
}
...
...
src/program.cpp
View file @
e55dd8e9
...
...
@@ -74,9 +74,9 @@ instruction_ref program::end() { return impl->instructions.end(); }
instruction_ref
program
::
validate
()
const
{
return
std
::
find_if
(
impl
->
instructions
.
begin
(),
impl
->
instructions
.
end
(),
[](
const
instruction
&
i
)
{
return
i
.
vali
d
()
;
});
return
std
::
find_if
(
impl
->
instructions
.
begin
(),
impl
->
instructions
.
en
d
()
,
[](
const
instruction
&
i
)
{
return
i
.
valid
();
});
}
literal
program
::
eval
(
std
::
unordered_map
<
std
::
string
,
argument
>
params
)
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