null
vuild_
Nodes
Flows
Hubs
Login
MENU
Notifications
Login
⌂
c-lang-advanced
Structure
advanced-pointers
•
Function Pointer
•
Pointer to Pointer
•
Void Pointer
data-structures
•
Linked List
•
Stack & Queue
•
Tree & Graph
algorithms
•
Sorting Algorithms
•
Complexity Analysis
bit-ops
•
Bitwise Operators
•
Bit Fields
•
Bit Tricks
system-prog
•
Process
•
Signal
•
IPC (Inter-Process Communication)
concurrency
•
Threads Basics
•
Mutex & Semaphore
•
Race Condition
optimization
•
Compiler Flags
•
Cache Locality
•
Profiling
design-patterns
•
OOP in C
•
Callback Pattern
•
State Machine
project
•
Mini Shell
•
TCP Echo Server
Flow Structure
Complexity Analysis
9 / 25
Bit Fields
☆ Star
↗ Full
Bitwise Operators
#c
#c-lang
#advanced
#bit-ops
#bitwise
@devpc
|
2026-03-29 13:49:33
|
GET /api/v1/flows/6/nodes/73?fv=1&nv=1
Context:
Flow v1
→
Node v1
0
Views
0
Calls
# Bitwise Operators > AND/OR/XOR/NOT/시프트 연산, 마스킹 기법 ## 학습 목표 - C의 비트 연산자 종류와 동작을 이해한다 - 마스킹 기법으로 특정 비트를 조작한다 ## 내용 ### 비트 연산자 종류 | 연산자 | 기호 | 설명 | |--------|------|------| | AND | `&` | 둘 다 1이면 1 | | OR | `\|` | 하나라도 1이면 1 | | XOR | `^` | 다르면 1 | | NOT | `~` | 비트 반전 | | 왼쪽 시프트 | `<<` | 비트를 왼쪽으로 이동 | | 오른쪽 시프트 | `>>` | 비트를 오른쪽으로 이동 | ### 마스킹 기법 ```c // 특정 비트 SET (3번째 비트 켜기) x = x | (1 << 3); // 특정 비트 CLEAR (3번째 비트 끄기) x = x & ~(1 << 3); // 특정 비트 TOGGLE (3번째 비트 토글) x = x ^ (1 << 3); // 특정 비트 확인 int bit = (x >> 3) & 1; ``` ## 참고 - 시프트 연산은 곱셈/나눗셈의 빠른 대안으로 활용된다: `x << 1` == `x * 2`
Complexity Analysis
Bit Fields
// COMMENTS
ON THIS PAGE
No content selected.