diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-09-24T15·21+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-09-24T15·21+0000 |
commit | df8873e14ad071812e27f38b69783f04dbae5f44 (patch) | |
tree | 34be83feb4734efcb21f4f3d1ced66db4c24e382 /src | |
parent | 2ab4bc44c780d2e28647f7559664675b756f38b9 (diff) |
* lessThan primitive for integer comparison.
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/primops.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 1739b6656d45..16d165634ffa 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -779,6 +779,14 @@ static Expr primAdd(EvalState & state, const ATermVector & args) } +static Expr primLessThan(EvalState & state, const ATermVector & args) +{ + int i1 = evalInt(state, args[0]); + int i2 = evalInt(state, args[1]); + return makeBool(i1 < i2); +} + + void EvalState::addPrimOps() { addPrimOp("builtins", 0, primBuiltins); @@ -810,6 +818,7 @@ void EvalState::addPrimOps() addPrimOp("removeAttrs", 2, primRemoveAttrs); addPrimOp("relativise", 2, primRelativise); addPrimOp("__add", 2, primAdd); + addPrimOp("__lessThan", 2, primLessThan); } |