Skip to content

IntEQ

IntEQ

Description

Test whether two numeric values compare equal. The right-hand operand may be an Int, Int*, const Int*, u64, or i64 compatible type.

Parameters

Name Direction Description
lhs in Left-hand integer
rhs in Right-hand operand selected through generic dispatch

Usage example (from documentation)

  if (IntEQ(&value, 10u)) { /* ... */ }

Returns

true when both values are equal.

Usage example (Cross-references)

Usage examples (Cross-references)
                Int next = IntInit();
    
                if (IntEQ(&mid, &one) || IntIsZero(&mid)) {
                    IntDeinit(&high);
                    high = IntInit();
        }
    
        if (IntEQ(&r, &one)) {
            Int positive = IntInit();
            Int mag_mod   = IntInit();
    
                IntPowMod(&x, &base, &d, value);
                if ((MISRA_PRIV_IntCompareU64(&x, 1) == 0) || IntEQ(&x, &n_minus_one)) {
                    IntDeinit(&base);
                    IntDeinit(&x);
                        x = next;
    
                        if (IntEQ(&x, &n_minus_one)) {
                            witness = false;
                            break;
    
        bool result = IntCompare(&lhs, &rhs) == 0;
        result      = result && IntEQ(&lhs, &rhs);
    
        IntDeinit(&lhs);
        result      = result && IntGT(&b, &a);
        result      = result && IntGE(&b, &a);
        result      = result && IntEQ(&b, &c);
        result      = result && IntGE(&b, &c);
        result      = result && IntLE(&b, &c);
        result      = result && (IntCompare(&value, -1) > 0);
        result      = result && (IntCompare(&big, UINT64_MAX) > 0);
        result      = result && IntEQ(&value, 42);
        result      = result && IntLE(&value, 42);
        result      = result && IntGT(&value, -1);
    
        bool result = !FloatToInt(&result_value, &value);
        result      = result && IntEQ(&result_value, 99);
    
        FloatDeinit(&value);
    
        bool result = !FloatToInt(&result_value, &value);
        result      = result && IntEQ(&result_value, 99);
    
        FloatDeinit(&value);
        Int clone    = IntClone(&original);
    
        bool result = IntEQ(&clone, &original);
        result      = result && (IntToU64(&clone) == 11);
        IntShiftLeft(&original, 1);
    
        result = result && !IntEQ(&clone, &original);
        result = result && (IntToU64(&clone) == 11);
        result = result && (IntToU64(&original) == 22);
Last updated on