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)
- In
Int.c:674:
}
void IntShiftRight(Int *value, u64 positions) {
ValidateInt(value);- In
Int.c:1215:
IntAdd(&sum, &low, &high);
IntShiftRight(&sum, 1);
mid = sum;- In
Int.c:1341:
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) {- In
Int.c:1547:
}
IntShiftRight(&exp, 1);
if (!IntIsZero(&exp)) {
Int next = IntInit();- In
Int.c:1678:
MISRA_PRIV_IntAddU64(&exponent, &exponent, 1);
IntShiftRight(&exponent, 2);
IntPowMod(&root, &a, &exponent, modulus);- In
Int.c:1698:
(void)MISRA_PRIV_IntSubU64(&q, &q, 1);
while (IntIsEven(&q)) {
IntShiftRight(&q, 1);
m++;
}- In
Int.c:1711:
exponent = IntClone(&q);
MISRA_PRIV_IntAddU64(&exponent, &exponent, 1);
IntShiftRight(&exponent, 1);
IntPowMod(&r, &a, &exponent, modulus);- In
Int.c:1819:
while (IntIsEven(&d)) {
IntShiftRight(&d, 1);
s++;
}- In
Int.Math.c:76:
bool test_int_shift_right_shrinks(void) {
WriteFmt("Testing IntShiftRight\n");
Int value = IntFromBinary("110000");- In
Int.Math.c:80:
Int value = IntFromBinary("110000");
IntShiftRight(&value, 4);
bool result = IntToU64(&value) == 3;
Last updated on