1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include "Array.h"
#include "BumpAlloc.h"
#include "GlobalArena.h"
#include "String.h"
#include <stdio.h>
int
main() {
g_arena = B_create(KiB(4));
BumpArena t_arena = B_create(KiB(4));
String* hexes = AG_new(sizeof(String), 8);
Result status = R_Ok;
for (usize i = 7; i <= 4830; i += 69) {
status = A_ppush(hexes, S_printf(t_arena, "%x", i));
if (R_Ok != status) {
fprintf(stderr, "Error(%d): %lu %lu\n", status, i, A_count(hexes));
}
}
String all = SG_printf("Total: %ld\n", A_count(hexes));
for (usize i = 0; i + 4 < A_count(hexes); i += 4) {
Result status = S_append(all, S_concat(t_arena, hexes[0+i], " ", hexes[1+i], " ", hexes[2+i], " ", hexes[3+i], "\n", NULL));
if (R_Ok != status) {
fprintf(stderr, "Error(%d): %lu %lu\n", status, i, A_count(hexes));
}
}
printf("%s", all);
B_destroy(g_arena);
B_destroy(t_arena);
return 0;
}
|