Moving Open code to C

This commit is contained in:
Krzosa Karol
2025-12-21 19:04:19 +01:00
parent 56b8b09f35
commit 0a315760f7
11 changed files with 141 additions and 631 deletions

View File

@@ -394,20 +394,18 @@ API String16 SkipWhitespace(String16 *string) {
return begin;
}
// chop this - :324
// chop this - 324
API String16 ChopNumberEx(String16 *string) {
String16 col = {};
for (int64_t i = string->len - 1; i >= 0; i -= 1) {
if (IsDigit(string->data[i])) {
col.data = string->data + i;
col.len += 1;
} else if (string->data[i] == L':') {
break;
} else {
return {};
break;
}
}
*string = Chop(*string, col.len + 1);
*string = Chop(*string, col.len);
return col;
}
@@ -416,7 +414,6 @@ API Int ChopNumber(String16 *string) {
String16 col = ChopNumberEx(string);
if (col.len == 0) return -1;
String num_string = ToString(scratch, col);
Int result = strtoll(num_string.data, NULL, 10) - 1;
Int result = strtoll(num_string.data, NULL, 10) - 1;
return result;
}