xo-reader2 stack: use NumericDispatch for *,/,+,- ops
This commit is contained in:
parent
43f120dd10
commit
9dca9a8c46
12 changed files with 167 additions and 17 deletions
|
|
@ -27,6 +27,9 @@ namespace xo {
|
|||
auto target_fn
|
||||
= NumericDispatch::instance().dispatch_[key].multiply_;
|
||||
|
||||
if (!target_fn)
|
||||
assert(false);
|
||||
|
||||
return (*target_fn)(rcx, x.data(), y.data());
|
||||
}
|
||||
|
||||
|
|
@ -35,23 +38,48 @@ namespace xo {
|
|||
obj<AGCObject> x,
|
||||
obj<AGCObject> y)
|
||||
{
|
||||
scope log(XO_DEBUG(true));
|
||||
|
||||
KeyType key(x._typeseq(), y._typeseq());
|
||||
|
||||
log && log(xtag("x.tseq", x._typeseq().seqno()),
|
||||
xtag("y.tseq", y._typeseq().seqno()));
|
||||
|
||||
auto target_fn
|
||||
= NumericDispatch::instance().dispatch_[key].divide_;
|
||||
|
||||
log && log(xtag("target_fn", target_fn));
|
||||
|
||||
assert(target_fn);
|
||||
if (!target_fn)
|
||||
assert(false);
|
||||
|
||||
return (*target_fn)(rcx, x.data(), y.data());
|
||||
}
|
||||
|
||||
obj<AGCObject>
|
||||
NumericDispatch::add(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject> x,
|
||||
obj<AGCObject> y)
|
||||
{
|
||||
KeyType key(x._typeseq(), y._typeseq());
|
||||
|
||||
auto target_fn
|
||||
= NumericDispatch::instance().dispatch_[key].add_;
|
||||
|
||||
if (!target_fn)
|
||||
assert(false);
|
||||
|
||||
return (*target_fn)(rcx, x.data(), y.data());
|
||||
}
|
||||
|
||||
obj<AGCObject>
|
||||
NumericDispatch::subtract(obj<ARuntimeContext> rcx,
|
||||
obj<AGCObject> x,
|
||||
obj<AGCObject> y)
|
||||
{
|
||||
KeyType key(x._typeseq(), y._typeseq());
|
||||
|
||||
auto target_fn
|
||||
= NumericDispatch::instance().dispatch_[key].subtract_;
|
||||
|
||||
if (!target_fn)
|
||||
assert(false);
|
||||
|
||||
return (*target_fn)(rcx, x.data(), y.data());
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue