xo-numeric: + cmple for op<=
This commit is contained in:
parent
b69ec48d00
commit
1a60284861
12 changed files with 86 additions and 56 deletions
|
|
@ -34,6 +34,8 @@ namespace xo {
|
|||
DFloat * x, DInteger * y);
|
||||
static obj<AGCObject> cmp_less(obj<ARuntimeContext> rcx,
|
||||
DFloat * x, DInteger * y);
|
||||
static obj<AGCObject> cmp_lessequal(obj<ARuntimeContext> rcx,
|
||||
DFloat * x, DInteger * y);
|
||||
};
|
||||
|
||||
class IntegerFloatOps {
|
||||
|
|
@ -56,6 +58,8 @@ namespace xo {
|
|||
DInteger * x, DFloat * y);
|
||||
static obj<AGCObject> cmp_less(obj<ARuntimeContext> rcx,
|
||||
DInteger * x, DFloat * y);
|
||||
static obj<AGCObject> cmp_lessequal(obj<ARuntimeContext> rcx,
|
||||
DInteger * x, DFloat * y);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ namespace xo {
|
|||
DFloat * x, DFloat * y);
|
||||
static obj<AGCObject> cmp_less(obj<ARuntimeContext> rcx,
|
||||
DFloat * x, DFloat * y);
|
||||
static obj<AGCObject> cmp_lessequal(obj<ARuntimeContext> rcx,
|
||||
DFloat * x, DFloat * y);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ namespace xo {
|
|||
DInteger * x, DInteger * y);
|
||||
static obj<AGCObject> cmp_less(obj<ARuntimeContext> rcx,
|
||||
DInteger * x, DInteger * y);
|
||||
static obj<AGCObject> cmp_lessequal(obj<ARuntimeContext> rcx,
|
||||
DInteger * x, DInteger * y);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -103,11 +103,16 @@ namespace xo {
|
|||
obj<AGCObject> x,
|
||||
obj<AGCObject> y);
|
||||
|
||||
/** compare two numeric values for inequality **/
|
||||
/** compare two numeric values for less **/
|
||||
static obj<AGCObject> cmp_less(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject> x,
|
||||
obj<AGCObject> y);
|
||||
|
||||
/** compare two numeric values for less-or-equal **/
|
||||
static obj<AGCObject> cmp_lessequal(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject> x,
|
||||
obj<AGCObject> y);
|
||||
|
||||
/** report memory use for owned arenas to @p visitor **/
|
||||
void visit_pools(const MemorySizeVisitor & visitor);
|
||||
|
||||
|
|
@ -123,7 +128,8 @@ namespace xo {
|
|||
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 cmplt_fn) {
|
||||
typename NumericOps<DRepr1, DRepr2>::BinaryOp_Impl cmplt_fn,
|
||||
typename NumericOps<DRepr1, DRepr2>::BinaryOp_Impl cmple_fn) {
|
||||
|
||||
KeyType key(typeseq::id<DRepr1>().seqno(),
|
||||
typeseq::id<DRepr2>().seqno());
|
||||
|
|
@ -136,7 +142,8 @@ namespace xo {
|
|||
sub_fn,
|
||||
cmpeq_fn,
|
||||
cmpne_fn,
|
||||
cmplt_fn);
|
||||
cmplt_fn,
|
||||
cmple_fn);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -28,9 +28,10 @@ namespace xo {
|
|||
BinaryOp subtract,
|
||||
BinaryOp cmpeq,
|
||||
BinaryOp cmpne,
|
||||
BinaryOp cmplt)
|
||||
BinaryOp cmplt,
|
||||
BinaryOp cmple)
|
||||
: multiply_{multiply}, divide_{divide}, add_{add}, subtract_{subtract},
|
||||
cmpeq_{cmpeq}, cmpne_{cmpne}, cmplt_{cmplt} {}
|
||||
cmpeq_{cmpeq}, cmpne_{cmpne}, cmplt_{cmplt}, cmple_{cmple} {}
|
||||
|
||||
BinaryOp multiply_ = nullptr;
|
||||
BinaryOp divide_ = nullptr;
|
||||
|
|
@ -43,6 +44,8 @@ namespace xo {
|
|||
BinaryOp cmpne_ = nullptr;
|
||||
/** compare numerics (<) **/
|
||||
BinaryOp cmplt_ = nullptr;
|
||||
/** compare numerics (<=) **/
|
||||
BinaryOp cmple_ = nullptr;
|
||||
};
|
||||
|
||||
template <typename DRepr1, typename DRepr2>
|
||||
|
|
@ -60,14 +63,16 @@ namespace xo {
|
|||
BinaryOp_Impl subtract,
|
||||
BinaryOp_Impl cmpeq,
|
||||
BinaryOp_Impl cmpne,
|
||||
BinaryOp_Impl cmplt) {
|
||||
BinaryOp_Impl cmplt,
|
||||
BinaryOp_Impl cmple) {
|
||||
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>(cmplt));
|
||||
reinterpret_cast<BinaryOp_Anon>(cmplt),
|
||||
reinterpret_cast<BinaryOp_Anon>(cmple));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ namespace xo {
|
|||
static DPrimitive_gco_2_gco_gco * make_cmpne_pm(obj<AAllocator> mm);
|
||||
/** polymorphic (in both arguments) compare (<) **/
|
||||
static DPrimitive_gco_2_gco_gco * make_cmplt_pm(obj<AAllocator> mm);
|
||||
/** polymorphic (in both arguments) compare (<=) **/
|
||||
static DPrimitive_gco_2_gco_gco * make_cmple_pm(obj<AAllocator> mm);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue