int lsr(int x, int n)
{
return (int)((unsigned int)x >> n);
}
More Related Contents:
- What is the fastest/most efficient way to find the highest set bit (msb) in an integer in C?
- Are the shift operators () arithmetic or logical in C?
- How can I multiply and divide using only bit shifting and adding?
- What is CHAR_BIT?
- Rounding up to next power of 2
- Catch and compute overflow during multiplication of two large integers
- SIMD signed with unsigned multiplication for 64-bit * 64-bit to 128-bit
- Bitwise operators and “endianness”
- Explain this snippet which finds the maximum of two integers without using if-else or any other comparison operator?
- Bitfield manipulation in C
- Fastest way to clamp a real (fixed/floating point) value?
- What’s bad about shifting a 32-bit variable 32 bits?
- Casting float to int (bitwise) in C
- What does the statement if (counter & (1
- Compute fast log base 2 ceiling
- Finding consecutive bit string of 1 or 0
- warning: left shift count >= width of type
- set the m-bit to n-bit [closed]
- Bitshift and integer promotion?
- Unexpected C/C++ bitwise shift operators outcome
- Encoding int value as an IEEE-754 float (binary32)
- C reverse bits in unsigned integer
- How to define and work with an array of bits in C?
- Algorithm to generate bit mask
- Check if a number is non zero using bitwise operators in C
- How to replace bits in a bitfield without affecting other bits using C
- C Programming – XOR Bitwise Operation
- Bitwise shifting array of char’s
- Order of fields when using a bit field in C
- What is bit masking?