Expr Parameter::get_scalar_expr() const { check_is_scalar(); const Type t = type(); if (t.is_float()) { switch (t.bits()) { case 32: return Expr(get_scalar<float>()); case 64: return Expr(get_scalar<double>()); } } else if (t.is_int()) { switch (t.bits()) { case 8: return Expr(get_scalar<int8_t>()); case 16: return Expr(get_scalar<int16_t>()); case 32: return Expr(get_scalar<int32_t>()); case 64: return Expr(get_scalar<int64_t>()); } } else if (t.is_uint()) { switch (t.bits()) { case 1: return make_bool(get_scalar<bool>()); case 8: return Expr(get_scalar<uint8_t>()); case 16: return Expr(get_scalar<uint16_t>()); case 32: return Expr(get_scalar<uint32_t>()); case 64: return Expr(get_scalar<uint64_t>()); } } return Expr(); }
void Parameter::set_max_value(Expr e) { check_is_scalar(); user_assert(e.type() == contents.ptr->type) << "Can't set parameter " << name() << " of type " << contents.ptr->type << " to have max value " << e << " of type " << e.type() << "\n"; contents.ptr->max_value = e; }
Expr Parameter::get_max_value() { check_is_scalar(); return contents.ptr->max_value; }
void *Parameter::get_scalar_address() const { check_is_scalar(); return &contents.ptr->data; }
Expr Parameter::get_min_value() const { check_is_scalar(); return contents.ptr->min_value; }