MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / minus

Method minus

src/Expression/Value.cpp:516–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

514}
515
516void SValue::minus(const Value* a, const Value* b) {
517 const SValue* aval = (const SValue*)a;
518 const SValue* bval = (const SValue*)b;
519 m_size = (aval->m_size > bval->m_size) ? aval->m_size : bval->m_size;
520 switch (aval->getType()) {
521 case Value::Type::Scalar:
522 m_negative = 0;
523 m_value.u_int = aval->m_value.u_int - bval->m_value.u_int;
524 m_type = Value::Type::Unsigned;
525 break;
526 case Value::Type::Double:
527 m_negative = ((aval->m_value.d_int - bval->m_value.d_int) < 0);
528 m_value.d_int = aval->m_value.d_int - bval->m_value.d_int;
529 m_type = Value::Type::Double;
530 break;
531 case Value::Type::Integer:
532 m_negative = ((aval->m_value.s_int - bval->m_value.s_int) < 0);
533 m_value.s_int = aval->m_value.s_int - bval->m_value.s_int;
534 m_type = Value::Type::Integer;
535 break;
536 default:
537 m_negative = 0;
538 m_value.u_int = aval->m_value.u_int - bval->m_value.u_int;
539 m_type = Value::Type::Unsigned;
540 break;
541 }
542 m_valid = a->isValid() && b->isValid();
543}
544
545void SValue::mult(const Value* a, const Value* b) {
546 const SValue* aval = (const SValue*)a;

Callers 1

evalExprMethod · 0.45

Calls 6

getTypeMethod · 0.45
isValidMethod · 0.45
getValueULMethod · 0.45
getValueDMethod · 0.45
getValueLMethod · 0.45
getSizeMethod · 0.45

Tested by

no test coverage detected