(SOC) Storage Only Commit

(ADD) Name, NameScope, Catlog, Object, String, Attribute, Char, Registry, Utils, Type, <Platform Support>, <Global Constants>, README

(MOD) Array, Var, Status, MemMan, <Common>
This commit is contained in:
William
2024-05-16 00:04:42 +08:00
parent 989e512f8f
commit 5f7a6c6f93
32 changed files with 1694 additions and 195 deletions

9
Utils/include/utils.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef COMPOUND_UTILS_H
# define COMPOUND_UTILS_H
# include <Compound/common.h>
# include <Compound/const.h>
int Utils_CalcDigits(long long n);
#endif /* COMPOUND_UTILS_H */

16
Utils/src/utils.c Normal file
View File

@@ -0,0 +1,16 @@
#include <Compound/utils.h>
int Utils_CalcDigits(long long n)
{
if (n == 0) {
return 1;
}
n = llabs(n);
/* Accumulate. */
register int i;
for (i = 0; n; i++) n /= 10;
return i;
}