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

Method plus

src/Expression/Value.cpp:487–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485}
486
487void SValue::plus(const Value* a, const Value* b) {
488 const SValue* aval = (const SValue*)a;
489 const SValue* bval = (const SValue*)b;
490 m_size = (aval->m_size > bval->m_size) ? aval->m_size : bval->m_size;
491 switch (aval->getType()) {
492 case Value::Type::Scalar:
493 m_negative = 0;
494 m_value.u_int = aval->m_value.u_int + bval->m_value.u_int;
495 m_type = Value::Type::Unsigned;
496 break;
497 case Value::Type::Double:
498 m_negative = ((aval->m_value.d_int + bval->m_value.d_int) < 0);
499 m_value.d_int = aval->m_value.d_int + bval->m_value.d_int;
500 m_type = Value::Type::Double;
501 break;
502 case Value::Type::Integer:
503 m_negative = ((aval->m_value.s_int + bval->m_value.s_int) < 0);
504 m_value.s_int = aval->m_value.s_int + bval->m_value.s_int;
505 m_type = Value::Type::Integer;
506 break;
507 default:
508 m_negative = 0;
509 m_value.u_int = aval->m_value.u_int + bval->m_value.u_int;
510 m_type = Value::Type::Unsigned;
511 break;
512 }
513 m_valid = a->isValid() && b->isValid();
514}
515
516void SValue::minus(const Value* a, const Value* b) {
517 const SValue* aval = (const SValue*)a;

Callers 2

evalExprMethod · 0.45
TESTFunction · 0.45

Calls 6

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

Tested by 1

TESTFunction · 0.36