Skip to content

IntIsEven

Description

Test whether the integer’s value is even.

Parameters

Name Direction Description
value in Integer to inspect.

Success

Returns true when the integer is even (including zero).

Failure

Returns false when the integer is odd.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool IntIsEven(const Int *value) {
        ValidateInt(value);
        return !int_is_odd(value);
        }
    
        if (IntIsZero(n) || IntIsEven(n)) {
            LOG_ERROR("n must be non-zero and odd");
            return false;
    
        while (!IntIsZero(&aa)) {
            while (IntIsEven(&aa)) {
                u64 n_mod_8 = 0;
                return false;
            }
            if (IntIsEven(modulus) || !prime) {
                IntDeinit(&a);
                return false;
                return false;
            }
            while (IntIsEven(&q)) {
                if (!IntShiftRight(&q, 1)) {
                    IntDeinit(&q);
            return true;
        }
        if (IntIsEven(value)) {
            return false;
        }
            }
    
            while (IntIsEven(&d)) {
                if (!IntShiftRight(&d, 1)) {
                    IntDeinit(&d);
            return true;
        }
        if (IntIsEven(&candidate)) {
            if (!int_add_u64(&candidate, &candidate, 1)) {
                IntDeinit(&candidate);
        Int odd  = IntFrom(43, &alloc.base);
    
        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