xo-numeric: type decoration for multiply
This commit is contained in:
parent
44c687dbfe
commit
940cfb963a
3 changed files with 19 additions and 4 deletions
|
|
@ -18,7 +18,8 @@ namespace xo {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** polymorphic (in both arguments1) multiply **/
|
/** polymorphic (in both arguments1) multiply **/
|
||||||
static DPrimitive_gco_2_gco_gco * make_multiply_pm(obj<AAllocator> mm);
|
static DPrimitive_gco_2_gco_gco * make_multiply_pm(obj<AAllocator> mm,
|
||||||
|
StringTable * stbl);
|
||||||
|
|
||||||
/** polymorphic (in both arguments) divide **/
|
/** polymorphic (in both arguments) divide **/
|
||||||
static DPrimitive_gco_2_gco_gco * make_divide_pm(obj<AAllocator> mm);
|
static DPrimitive_gco_2_gco_gco * make_divide_pm(obj<AAllocator> mm);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include "NumericPrimitives.hpp"
|
#include "NumericPrimitives.hpp"
|
||||||
#include "NumericDispatch.hpp"
|
#include "NumericDispatch.hpp"
|
||||||
|
#include <xo/type/AtomicType.hpp>
|
||||||
|
#include <xo/type/FunctionType.hpp>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
using xo::mm::AAllocator;
|
using xo::mm::AAllocator;
|
||||||
|
|
@ -13,9 +15,21 @@ namespace xo {
|
||||||
namespace scm {
|
namespace scm {
|
||||||
|
|
||||||
DPrimitive_gco_2_gco_gco *
|
DPrimitive_gco_2_gco_gco *
|
||||||
NumericPrimitives::make_multiply_pm(obj<AAllocator> mm)
|
NumericPrimitives::make_multiply_pm(obj<AAllocator> mm,
|
||||||
|
StringTable * stbl)
|
||||||
{
|
{
|
||||||
return DPrimitive_gco_2_gco_gco::_make(mm, "_mul",
|
(void)stbl;
|
||||||
|
|
||||||
|
// TODO: want to expand this to record schedule based on argument types.
|
||||||
|
//
|
||||||
|
// e.g. f64 x f64 -> f64
|
||||||
|
|
||||||
|
auto numeric_ty = DAtomicType::make(mm, Metatype::t_numeric());
|
||||||
|
// #op+: numeric x numeric -> numeric
|
||||||
|
auto pm_ty = obj<AType,DFunctionType>
|
||||||
|
(DFunctionType::_make(mm, numeric_ty, numeric_ty, numeric_ty));
|
||||||
|
|
||||||
|
return DPrimitive_gco_2_gco_gco::_make(mm, "_mul", pm_ty,
|
||||||
&NumericDispatch::multiply);
|
&NumericDispatch::multiply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ namespace xo {
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
ok = ok & install_aux(sink,
|
ok = ok & install_aux(sink,
|
||||||
NumericPrimitives::make_multiply_pm(mm),
|
NumericPrimitives::make_multiply_pm(mm, stbl),
|
||||||
flags & InstallFlags::f_essential);
|
flags & InstallFlags::f_essential);
|
||||||
ok = ok & install_aux(sink,
|
ok = ok & install_aux(sink,
|
||||||
NumericPrimitives::make_divide_pm(mm),
|
NumericPrimitives::make_divide_pm(mm),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue