Skip to content

IntIsEven

IntIsEven

Description

Test whether the integer is even.

Parameters

Name Direction Description
value in Integer to test

Usage example (from documentation)

  bool even = IntIsEven(&value);

Returns

true when the least-significant bit is zero.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool IntIsEven(Int *value) {
        ValidateInt(value);
        return !int_is_odd(value);
        ValidateInt(n);
    
        if (IntIsZero(n) || IntIsEven(n)) {
            LOG_FATAL("n must be non-zero and odd");
        }
    
        while (!IntIsZero(&aa)) {
            while (IntIsEven(&aa)) {
                u64 n_mod_8 = 0;
            return true;
        }
        if (IntIsEven(modulus) || !IntIsProbablePrime(modulus)) {
            IntDeinit(&a);
            return false;
    
            (void)MISRA_PRIV_IntSubU64(&q, &q, 1);
            while (IntIsEven(&q)) {
                IntShiftRight(&q, 1);
                m++;
            return true;
        }
        if (IntIsEven(value)) {
            return false;
        }
            n_minus_one = IntClone(&d);
    
            while (IntIsEven(&d)) {
                IntShiftRight(&d, 1);
                s++;
            return;
        }
        if (IntIsEven(&candidate)) {
            MISRA_PRIV_IntAddU64(&candidate, &candidate, 1);
        }
        Int odd  = IntFrom(43);
    
        bool result = IntIsEven(&even);
        result      = result && !IntIsOdd(&even);
        result      = result && IntIsOdd(&odd);
        result      = result && !IntIsOdd(&even);
        result      = result && IntIsOdd(&odd);
        result      = result && !IntIsEven(&odd);
    
        IntDeinit(&even);
Last updated on