Skip to content

Commit 9ddb4d2

Browse files
authored
Merge pull request #86 from HKhademian/bundler-reminder
Bundler reminder
2 parents 07935b1 + 5e6b389 commit 9ddb4d2

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

nob.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,9 @@ bool generate_resource_bundle(void)
142142

143143
genf(out, "unsigned char bundle[] = {");
144144
size_t row_size = 20;
145-
for (size_t row = 0; row < bundle.count/row_size; ++row){
145+
for (size_t i = 0; i < bundle.count; ){
146146
fprintf(out, " ");
147-
for (size_t col = 0; col < row_size; ++col) {
148-
size_t i = row*row_size + col;
149-
fprintf(out, "0x%02X, ", (unsigned char)bundle.items[i]);
150-
}
151-
genf(out, "");
152-
}
153-
size_t remainder = bundle.count%row_size;
154-
if (remainder > 0) {
155-
fprintf(out, " ");
156-
for (size_t col = 0; col < remainder; ++col) {
157-
size_t i = bundle.count/row_size*row_size + col;
147+
for (size_t col = 0; col < row_size && i < bundle.count; ++col, ++i) {
158148
fprintf(out, "0x%02X, ", (unsigned char)bundle.items[i]);
159149
}
160150
genf(out, "");

0 commit comments

Comments
 (0)