xo-numeric: + less than dispatch (also in schematika parser)
This commit is contained in:
parent
a62bb4cec8
commit
5791cd59ce
12 changed files with 83 additions and 13 deletions
|
|
@ -32,6 +32,8 @@ namespace xo {
|
|||
DFloat * x, DInteger * y);
|
||||
static obj<AGCObject> cmp_notequal(obj<ARuntimeContext> rcx,
|
||||
DFloat * x, DInteger * y);
|
||||
static obj<AGCObject> cmp_less(obj<ARuntimeContext> rcx,
|
||||
DFloat * x, DInteger * y);
|
||||
};
|
||||
|
||||
class IntegerFloatOps {
|
||||
|
|
@ -52,6 +54,8 @@ namespace xo {
|
|||
DInteger * x, DFloat * y);
|
||||
static obj<AGCObject> cmp_notequal(obj<ARuntimeContext> rcx,
|
||||
DInteger * x, DFloat * y);
|
||||
static obj<AGCObject> cmp_less(obj<ARuntimeContext> rcx,
|
||||
DInteger * x, DFloat * y);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ namespace xo {
|
|||
DFloat * x, DFloat * y);
|
||||
static obj<AGCObject> cmp_notequal(obj<ARuntimeContext> rcx,
|
||||
DFloat * x, DFloat * y);
|
||||
static obj<AGCObject> cmp_less(obj<ARuntimeContext> rcx,
|
||||
DFloat * x, DFloat * y);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ namespace xo {
|
|||
DInteger * x, DInteger * y);
|
||||
static obj<AGCObject> cmp_notequal(obj<ARuntimeContext> rcx,
|
||||
DInteger * x, DInteger * y);
|
||||
static obj<AGCObject> cmp_less(obj<ARuntimeContext> rcx,
|
||||
DInteger * x, DInteger * y);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,11 @@ namespace xo {
|
|||
obj<AGCObject> x,
|
||||
obj<AGCObject> y);
|
||||
|
||||
/** compare two numeric values for inequality **/
|
||||
static obj<AGCObject> cmp_less(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject> x,
|
||||
obj<AGCObject> y);
|
||||
|
||||
/** report memory use for owned arenas to @p visitor **/
|
||||
void visit_pools(const MemorySizeVisitor & visitor);
|
||||
|
||||
|
|
@ -117,7 +122,8 @@ namespace xo {
|
|||
typename NumericOps<DRepr1, DRepr2>::BinaryOp_Impl add_fn,
|
||||
typename NumericOps<DRepr1, DRepr2>::BinaryOp_Impl sub_fn,
|
||||
typename NumericOps<DRepr1, DRepr2>::BinaryOp_Impl cmpeq_fn,
|
||||
typename NumericOps<DRepr1, DRepr2>::BinaryOp_Impl cmpne_fn) {
|
||||
typename NumericOps<DRepr1, DRepr2>::BinaryOp_Impl cmpne_fn,
|
||||
typename NumericOps<DRepr1, DRepr2>::BinaryOp_Impl cmplt_fn) {
|
||||
|
||||
KeyType key(typeseq::id<DRepr1>().seqno(),
|
||||
typeseq::id<DRepr2>().seqno());
|
||||
|
|
@ -129,7 +135,8 @@ namespace xo {
|
|||
add_fn,
|
||||
sub_fn,
|
||||
cmpeq_fn,
|
||||
cmpne_fn);
|
||||
cmpne_fn,
|
||||
cmplt_fn);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -27,19 +27,22 @@ namespace xo {
|
|||
BinaryOp add,
|
||||
BinaryOp subtract,
|
||||
BinaryOp cmpeq,
|
||||
BinaryOp cmpne)
|
||||
BinaryOp cmpne,
|
||||
BinaryOp cmplt)
|
||||
: multiply_{multiply}, divide_{divide}, add_{add}, subtract_{subtract},
|
||||
cmpeq_{cmpeq}, cmpne_{cmpne} {}
|
||||
cmpeq_{cmpeq}, cmpne_{cmpne}, cmplt_{cmplt} {}
|
||||
|
||||
BinaryOp multiply_ = nullptr;
|
||||
BinaryOp divide_ = nullptr;
|
||||
BinaryOp add_ = nullptr;
|
||||
BinaryOp subtract_ = nullptr;
|
||||
|
||||
/** compare numerics for equality **/
|
||||
/** compare numerics (==) **/
|
||||
BinaryOp cmpeq_ = nullptr;
|
||||
/** compare numerics for inequality **/
|
||||
/** compare numerics (!=) **/
|
||||
BinaryOp cmpne_ = nullptr;
|
||||
/** compare numerics (<) **/
|
||||
BinaryOp cmplt_ = nullptr;
|
||||
};
|
||||
|
||||
template <typename DRepr1, typename DRepr2>
|
||||
|
|
@ -56,13 +59,15 @@ namespace xo {
|
|||
BinaryOp_Impl add,
|
||||
BinaryOp_Impl subtract,
|
||||
BinaryOp_Impl cmpeq,
|
||||
BinaryOp_Impl cmpne) {
|
||||
BinaryOp_Impl cmpne,
|
||||
BinaryOp_Impl cmplt) {
|
||||
return AnonymizedNumericOps(reinterpret_cast<BinaryOp_Anon>(multiply),
|
||||
reinterpret_cast<BinaryOp_Anon>(divide),
|
||||
reinterpret_cast<BinaryOp_Anon>(add),
|
||||
reinterpret_cast<BinaryOp_Anon>(subtract),
|
||||
reinterpret_cast<BinaryOp_Anon>(cmpeq),
|
||||
reinterpret_cast<BinaryOp_Anon>(cmpne));
|
||||
reinterpret_cast<BinaryOp_Anon>(cmpne),
|
||||
reinterpret_cast<BinaryOp_Anon>(cmplt));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ namespace xo {
|
|||
static DPrimitive_gco_2_gco_gco s_cmpeq_gco_gco_pm;
|
||||
/** polymorphic (in both arguments) compare (!=) **/
|
||||
static DPrimitive_gco_2_gco_gco s_cmpne_gco_gco_pm;
|
||||
/** polymorphic (in both arguments) compare (<) **/
|
||||
static DPrimitive_gco_2_gco_gco s_cmplt_gco_gco_pm;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue