bitwise_ror
bits = 12345; // 12345 ( 001100000011 1001 )
rol = bitwise_ror(bits, 4, 16); // 37635 ( 1001 001100000011 )
- bitwise_ror(n,count,size)
- Returns the given number rotated to the right by given number of bits.
COPY/// bitwise_ror(n,count,size)
//
// Returns the given number rotated to
// the right by given number of bits.
//
// n number to be rotated right
// count number of bits to rotate
// size size of number in bits
//
/// gmlscripts.pro/license
{
var n,count,size;
n = argument0;
count = argument1;
size = argument2;
return (n >> count) | ((n << (size - count)) & (1 << size)-1);
}
Contributors: EyeGuy
GitHub: View · Commits · Blame · Raw