1 개요[ | ]
- 비트연산 shift right, right shift
- 오른쪽 시프트, 오른쪽 쉬프트, 오른쪽으로 시프트
2 Bash[ | ]
Bash
Copy
echo $(( 7 >> 0 ))
# 7
echo $(( 7 >> 1 ))
# 3
echo $(( 7 >> 2 ))
# 1
3 C[ | ]
C
Copy
#include<stdio.h>
int main() {
printf("%d\n", 7>>0 ); // 7
printf("%d\n", 7>>1 ); // 3
printf("%d\n", 7>>2 ); // 1
printf("%d\n", 7>>3 ); // 0
printf("%d\n", 7>>4 ); // 0
}
4 PHP[ | ]
PHP
Copy
echo 7 >> 1; // 3
echo 7 >> 2; // 1
5 Python[ | ]
Python
Copy
print 7 >> 1 # 3
print 7 >> 2 # 1