Skip to content

IntShiftRight

IntShiftRight

Description

Shift an integer right by the given number of bit positions.

Parameters

Name Direction Description
value in Integer to modify
positions in Number of low bits to discard

Usage example (from documentation)

  IntShiftRight(&value, 1);

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    void IntShiftRight(Int *value, u64 positions) {
        ValidateInt(value);
    
            IntAdd(&sum, &low, &high);
            IntShiftRight(&sum, 1);
            mid = sum;
                u64 n_mod_8 = 0;
    
                IntShiftRight(&aa, 1);
                n_mod_8 = MISRA_PRIV_IntModU64(&nn, 8);
                if (n_mod_8 == 3 || n_mod_8 == 5) {
            }
    
            IntShiftRight(&exp, 1);
            if (!IntIsZero(&exp)) {
                Int next = IntInit();
    
            MISRA_PRIV_IntAddU64(&exponent, &exponent, 1);
            IntShiftRight(&exponent, 2);
            IntPowMod(&root, &a, &exponent, modulus);
            (void)MISRA_PRIV_IntSubU64(&q, &q, 1);
            while (IntIsEven(&q)) {
                IntShiftRight(&q, 1);
                m++;
            }
            exponent = IntClone(&q);
            MISRA_PRIV_IntAddU64(&exponent, &exponent, 1);
            IntShiftRight(&exponent, 1);
            IntPowMod(&r, &a, &exponent, modulus);
    
            while (IntIsEven(&d)) {
                IntShiftRight(&d, 1);
                s++;
            }
    
    bool test_int_shift_right_shrinks(void) {
        WriteFmt("Testing IntShiftRight\n");
    
        Int value = IntFromBinary("110000");
        Int value = IntFromBinary("110000");
    
        IntShiftRight(&value, 4);
    
        bool result = IntToU64(&value) == 3;
Last updated on