Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
1a7c996a
Commit
1a7c996a
authored
Jul 10, 2014
by
Christopher Dembia
Browse files
Fix lepton size_t VS2013 warnings by casting to int.
parent
0c00acd2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
9 deletions
+9
-9
libraries/lepton/src/CompiledExpression.cpp
libraries/lepton/src/CompiledExpression.cpp
+3
-3
libraries/lepton/src/ExpressionProgram.cpp
libraries/lepton/src/ExpressionProgram.cpp
+2
-2
libraries/lepton/src/ParsedExpression.cpp
libraries/lepton/src/ParsedExpression.cpp
+1
-1
libraries/lepton/src/Parser.cpp
libraries/lepton/src/Parser.cpp
+3
-3
No files found.
libraries/lepton/src/CompiledExpression.cpp
View file @
1a7c996a
...
...
@@ -84,13 +84,13 @@ void CompiledExpression::compileExpression(const ExpressionTreeNode& node, vecto
// Process this node.
if
(
node
.
getOperation
().
getId
()
==
Operation
::
VARIABLE
)
{
variableIndices
[
node
.
getOperation
().
getName
()]
=
workspace
.
size
();
variableIndices
[
node
.
getOperation
().
getName
()]
=
(
int
)
workspace
.
size
();
variableNames
.
insert
(
node
.
getOperation
().
getName
());
}
else
{
int
stepIndex
=
arguments
.
size
();
int
stepIndex
=
(
int
)
arguments
.
size
();
arguments
.
push_back
(
vector
<
int
>
());
target
.
push_back
(
workspace
.
size
());
target
.
push_back
(
(
int
)
workspace
.
size
());
operation
.
push_back
(
node
.
getOperation
().
clone
());
if
(
args
.
size
()
==
0
)
arguments
[
stepIndex
].
push_back
(
0
);
// The value won't actually be used. We just need something there.
...
...
libraries/lepton/src/ExpressionProgram.cpp
View file @
1a7c996a
...
...
@@ -71,13 +71,13 @@ ExpressionProgram& ExpressionProgram::operator=(const ExpressionProgram& program
}
void
ExpressionProgram
::
buildProgram
(
const
ExpressionTreeNode
&
node
)
{
for
(
int
i
=
node
.
getChildren
().
size
()
-
1
;
i
>=
0
;
i
--
)
for
(
int
i
=
(
int
)
node
.
getChildren
().
size
()
-
1
;
i
>=
0
;
i
--
)
buildProgram
(
node
.
getChildren
()[
i
]);
operations
.
push_back
(
node
.
getOperation
().
clone
());
}
int
ExpressionProgram
::
getNumOperations
()
const
{
return
operations
.
size
();
return
(
int
)
operations
.
size
();
}
const
Operation
&
ExpressionProgram
::
getOperation
(
int
index
)
const
{
...
...
libraries/lepton/src/ParsedExpression.cpp
View file @
1a7c996a
...
...
@@ -60,7 +60,7 @@ double ParsedExpression::evaluate(const map<string, double>& variables) const {
}
double
ParsedExpression
::
evaluate
(
const
ExpressionTreeNode
&
node
,
const
map
<
string
,
double
>&
variables
)
{
int
numArgs
=
node
.
getChildren
().
size
();
int
numArgs
=
(
int
)
node
.
getChildren
().
size
();
vector
<
double
>
args
(
max
(
numArgs
,
1
));
for
(
int
i
=
0
;
i
<
numArgs
;
i
++
)
args
[
i
]
=
evaluate
(
node
.
getChildren
()[
i
],
variables
);
...
...
libraries/lepton/src/Parser.cpp
View file @
1a7c996a
...
...
@@ -70,7 +70,7 @@ string Parser::trim(const string& expression) {
int
start
,
end
;
for
(
start
=
0
;
start
<
(
int
)
expression
.
size
()
&&
isspace
(
expression
[
start
]);
start
++
)
;
for
(
end
=
expression
.
size
()
-
1
;
end
>
start
&&
isspace
(
expression
[
end
]);
end
--
)
for
(
end
=
(
int
)
expression
.
size
()
-
1
;
end
>
start
&&
isspace
(
expression
[
end
]);
end
--
)
;
if
(
start
==
end
&&
isspace
(
expression
[
end
]))
return
""
;
...
...
@@ -140,7 +140,7 @@ vector<ParseToken> Parser::tokenize(const string& expression) {
ParseToken
token
=
getNextToken
(
expression
,
pos
);
if
(
token
.
getType
()
!=
ParseToken
::
Whitespace
)
tokens
.
push_back
(
token
);
pos
+=
token
.
getText
().
size
();
pos
+=
(
int
)
token
.
getText
().
size
();
}
return
tokens
;
}
...
...
@@ -257,7 +257,7 @@ ExpressionTreeNode Parser::parsePrecedence(const vector<ParseToken>& tokens, int
while
(
pos
<
(
int
)
tokens
.
size
()
&&
tokens
[
pos
].
getType
()
==
ParseToken
::
Operator
)
{
token
=
tokens
[
pos
];
int
opIndex
=
Operators
.
find
(
token
.
getText
());
int
opIndex
=
(
int
)
Operators
.
find
(
token
.
getText
());
int
opPrecedence
=
Precedence
[
opIndex
];
if
(
opPrecedence
<
precedence
)
return
result
;
...
...
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