Skip to content

Commit c35c238

Browse files
committed
update popcnt
1 parent cf25305 commit c35c238

11 files changed

Lines changed: 436 additions & 14 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ OpenCSTL과 대응하는 C++ STL 코드입니다.
7474
| ![](./assets/codes/sample05_deque.c.webp) | ![](./assets/codes/sample05_deque.cpp.webp) |
7575
| ![](./assets/codes/sample06_map.c.webp) | ![](./assets/codes/sample06_map.cpp.webp) |
7676
| ![](./assets/codes/sample07_priority_queue.c.webp) | ![](./assets/codes/sample07_priority_queue.cpp.webp) |
77+
| ![](./assets/codes/sample08_bitset.c.webp)|![](./assets/codes/sample08_bitset.cpp.webp) |
7778

7879

7980

@@ -192,6 +193,7 @@ OpenCSTL과 대응하는 C++ STL 코드입니다.
192193
H(hashtable.h)
193194
end
194195
196+
B(bitset.h) --> OCSTL(opencstl.h)
195197
V(vector.h) --> OCSTL(opencstl.h)
196198
LST(list.h) --> OCSTL(opencstl.h)
197199
TREE(tree.h) --> OCSTL(opencstl.h)

assets/codes/png2webp.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import cv2
22
import numpy as np
33
from glob import glob
4-
4+
import os
55
files = glob("./*.png")
66

77
for file in files:
88
img = cv2.imread(file)
99
cv2.imwrite(file.replace(".png", ".webp"), img)
10+
os.remove(file)
418 KB
Loading
407 KB
Loading

assets/sample08_bitset.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "opencstl.h"
2+
3+
int main() {
4+
BITSET b = new_bitset(50);
5+
6+
bitset.set_at(b, 10,true);
7+
bitset.set_at(b, 0,true);
8+
int cnt = bitset.count(b);
9+
printf("%d\n", cnt);
10+
11+
char *str = bitset.to_string(b);
12+
puts(str);
13+
14+
bitset.free(b);
15+
return 0;
16+
}

assets/sample08_bitset.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <iostream>
2+
#include <bitset>
3+
4+
int main() {
5+
std::bitset<50> b;
6+
7+
b[10] = true;
8+
b[0] = true;
9+
10+
int cnt = b.count();
11+
std::cout << cnt << std::endl;
12+
13+
std::string str = b.to_string();
14+
std::cout << str << std::endl;
15+
return 0;
16+
}

0 commit comments

Comments
 (0)