1
+ # ` BitArray `
1
2
2
- # BitArray
3
+ > * Read this in other languages: [ English ] ( README.md ) , : kr : [ Korean ] ( README.ko.md )
3
4
4
- ` BitArray ` 는 ** 비트 단위 데이터 조작 및 관리** 를 위한 경량 유틸리티입니다.
5
- ** C++** 및 ** Python** 두 언어로 구현되어 있으며, 네트워크, 데이터 압축, 바이너리 분석 등의 분야에서 활용 가능합니다.
5
+ <br />
6
+
7
+ ` BitArray ` is a lightweight class for ** bit-level data manipulation and management** .
8
+ It is implemented in both ** C++** and ** Python** , and can be used in areas such as networking, data compression, and binary analysis.
6
9
7
- ## 📁 프로젝트 구조
10
+ ## 📁 Project Structure
8
11
9
12
```
10
13
BitArray-main/
11
- ├── cpp/ # C++ 구현
14
+ ├── cpp/ # C++ implementation
12
15
│ ├── main.cpp
13
16
│ └── README.md
14
- ├── python/ # Python 구현
17
+ ├── python/ # Python implementation
15
18
│ ├── BitArray.py
16
19
│ └── README.md
17
- ├── README.md # 프로젝트 소개 문서
20
+ ├── README.md # Project introduction
18
21
├── LICENSE
19
22
└── .gitignore
20
23
```
21
24
22
25
---
23
26
24
- ## 💡 기능 요약
27
+ ## 💡 Feature Summary
25
28
26
- | 기능 | 설명 |
27
- | ---------------| ----------------------------------------------------------------------|
28
- | 비트 초기화 | 바이트 배열 또는 비트 크기를 기반으로 비트 배열 생성 |
29
- | 비트 추출 | 특정 오프셋과 길이에 따라 부분 비트 배열 추출 |
30
- | 비트 병합 | 다른 비트 배열을 지정 위치에 병합 가능 |
31
- | 비트 연산 | ` + ` , ` << ` , ` >> ` 연산자 지원 |
32
- | 비트 반전 | 비트 순서를 역으로 뒤집는 ` reverser() ` 지원 |
33
- | 시각화 | 사람이 읽기 쉬운 형식으로 비트 출력 ( ` print ` , ` dump ` ) |
34
- | 유닛 테스트 | 다양한 연산에 대한 테스트 코드 포함 |
29
+ | Feature | Description |
30
+ | ---------------- | ---- ----------------------------------------------------------------------|
31
+ | Bit Initialization | Create bit arrays from byte arrays or specified bit sizes |
32
+ | Bit Extraction | Extract sub-bit arrays based on offset and length |
33
+ | Bit Merging | Merge another bit array at a specified position |
34
+ | Bit Operations | Supports operators like ` + ` , ` << ` , ` >> ` |
35
+ | Bit Reversal | Supports ` reverser() ` to reverse bit order |
36
+ | Visualization | Print bits in human-readable format using ` print ` , ` dump ` |
37
+ | Unit Testing | Includes test code for various operations |
35
38
36
39
---
37
40
38
- ## 🧠 언어별 구현
41
+ ## 🧠 Language Implementations
39
42
40
43
### ✅ C++
41
44
42
- - 구현 파일 : ` cpp/ `
43
- - 주요 클래스 : ` BitArray `
44
- - STL 기반 고성능 구현
45
- - 단위 테스트 포함 ( main.cpp)
46
- - 주요 특징 :
47
- - ` std::vector<uint8_t> ` 기반 저장
48
- - ` get ` , ` merge ` , ` toArray ` , ` dump ` 등 다양한 비트 처리 메서드 제공
45
+ - Source files : ` cpp/ `
46
+ - Main class : ` BitArray `
47
+ - High-performance implementation based on STL
48
+ - Includes unit test ( ` main.cpp ` )
49
+ - Highlights :
50
+ - Uses ` std::vector<uint8_t> ` for storage
51
+ - Offers various bit manipulation methods like ` get ` , ` merge ` , ` toArray ` , ` dump `
49
52
50
- 📄 자세한 내용 : [ ` cpp/README.md ` ] ( cpp/README.md )
53
+ 📄 More details : [ ` cpp/README.md ` ] ( cpp/README.md )
51
54
52
55
---
53
56
54
57
### ✅ Python
55
58
56
- - 구현 파일 : ` python/ `
57
- - 주요 클래스 : ` BitArray `
58
- - 파이썬 리스트와 비트 조작을 통한 구현
59
- - 주요 특징 :
60
- - 비트 배열 병합 및 추출
61
- - ` to_array ` , ` to_int_array ` , ` reverser ` , ` __add__ ` , ` __rshift__ ` , ` __lshift__ ` 지원
62
- - 단위 테스트 함수 포함
59
+ - Source files : ` python/ `
60
+ - Main class : ` BitArray `
61
+ - Implemented using Python lists and bit manipulation
62
+ - Highlights :
63
+ - Supports merging and extracting bit arrays
64
+ - Provides ` to_array ` , ` to_int_array ` , ` reverser ` , ` __add__ ` , ` __rshift__ ` , ` __lshift__ `
65
+ - Includes unit test function
63
66
64
- 📄 자세한 내용 : [ ` python/README.md ` ] ( python/README.md )
67
+ 📄 More details : [ ` python/README.md ` ] ( python/README.md )
65
68
66
69
---
67
70
68
- ## 🔬 사용 예시
71
+ ## 🔬 Usage Examples
69
72
70
- ### C++ 예시
73
+ ### C++ Example
71
74
72
75
``` cpp
73
76
BitArray a ({0b11000000}, 3);
74
- a.print(); // 출력 : 110
77
+ a.print(); // Output : 110
75
78
76
79
BitArray b({0b01000000}, 2);
77
80
auto c = a + b;
78
- c.print(); // 출력 : 11001
81
+ c.print(); // Output : 11001
79
82
```
80
83
81
- ### Python 예시
84
+ ### Python Example
82
85
83
86
```python
84
87
bit_array = BitArray([0b11000000], 8)
85
- bit_array.print() # 출력 : 1100 0000
88
+ bit_array.print() # Output : 1100 0000
86
89
87
90
sub_array = bit_array.get(2, 3)
88
- sub_array.print() # 출력 : 000
91
+ sub_array.print() # Output : 000
89
92
```
90
93
91
94
---
92
95
93
- ## 🔧 설치 및 실행
96
+ ## 🔧 Installation and Execution
94
97
95
98
### C++
96
99
``` bash
@@ -102,18 +105,18 @@ g++ main.cpp -std=c++17 -o bitarray
102
105
### Python
103
106
``` bash
104
107
cd python
105
- python3 BitArray.py # 내부에서 runTests() 실행 가능
108
+ python3 BitArray.py # Runs runTests() internally
106
109
```
107
110
108
111
---
109
112
110
- ## 🧪 테스트
113
+ ## 🧪 Testing
111
114
112
- 각 구현에 단위 테스트 코드 포함되어 있어, 실행 시 기능이 정상 동작하는지 확인할 수 있습니다 .
115
+ Each implementation includes unit test code to verify functionality upon execution .
113
116
114
117
---
115
118
116
- ## 📜 라이선스
119
+ ## 📜 License
117
120
118
121
- MIT License
119
122
- https://github.com/JayTwoLab/BitArray
0 commit comments