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