Made parse_number inlined and made an arg const char *. Not sure if inlining will work, but I'm lazy to check. :P

This commit is contained in:
Alexander Andreev 2023-12-07 00:44:19 +04:00
parent 17df598e16
commit 4dbf46697c
Signed by: Arav
GPG Key ID: D22A817D95815393
7 changed files with 14 additions and 14 deletions

View File

@ -5,7 +5,7 @@
#include <stdint.h> #include <stdint.h>
uint64_t parse_number(char *end); inline uint64_t parse_number(const char *end);
#define SETS_STR_MAX_LEN 200 #define SETS_STR_MAX_LEN 200
@ -66,7 +66,7 @@ int main(int argc, char **argv) {
return 0; return 0;
} }
uint64_t parse_number(char *end) { inline uint64_t parse_number(const char *end) {
uint64_t num = 0; uint64_t num = 0;
for (size_t n = 1;; n *= 10) { for (size_t n = 1;; n *= 10) {

View File

@ -5,7 +5,7 @@
#include <stdint.h> #include <stdint.h>
uint64_t parse_number(char *end); inline uint64_t parse_number(const char *end);
#define SETS_STR_MAX_LEN 200 #define SETS_STR_MAX_LEN 200
@ -72,7 +72,7 @@ int main(int argc, char **argv) {
return 0; return 0;
} }
uint64_t parse_number(char *end) { inline uint64_t parse_number(const char *end) {
uint64_t num = 0; uint64_t num = 0;
for (size_t n = 1;; n *= 10) { for (size_t n = 1;; n *= 10) {

View File

@ -7,7 +7,7 @@
#define ISDIGIT(c) (c >= 0x30 && c <= 0x39) #define ISDIGIT(c) (c >= 0x30 && c <= 0x39)
uint64_t parse_number(char *line, ssize_t j); inline uint64_t parse_number(const char *line, ssize_t j);
int main(int argc, char **argv) { int main(int argc, char **argv) {
@ -101,7 +101,7 @@ int main(int argc, char **argv) {
return 0; return 0;
} }
uint64_t parse_number(char *line, ssize_t j) { inline uint64_t parse_number(const char *line, ssize_t j) {
uint64_t n = 0; uint64_t n = 0;
uint64_t multiplier = 1; uint64_t multiplier = 1;

View File

@ -5,7 +5,7 @@
#include <stdint.h> #include <stdint.h>
uint64_t parse_number(char *end); inline uint64_t parse_number(const char *end);
int main(int argc, char **argv) { int main(int argc, char **argv) {
@ -66,7 +66,7 @@ int main(int argc, char **argv) {
return 0; return 0;
} }
uint64_t parse_number(char *end) { inline uint64_t parse_number(const char *end) {
uint64_t num = 0; uint64_t num = 0;
for (size_t n = 1;; n *= 10) { for (size_t n = 1;; n *= 10) {

View File

@ -8,7 +8,7 @@
#define STACK_SZ UINT8_MAX+1 #define STACK_SZ UINT8_MAX+1
typedef uint8_t stackpointer_t; typedef uint8_t stackpointer_t;
uint64_t parse_number(char *end); inline uint64_t parse_number(const char *end);
int main(int argc, char **argv) { int main(int argc, char **argv) {
@ -76,7 +76,7 @@ int main(int argc, char **argv) {
return 0; return 0;
} }
uint64_t parse_number(char *end) { inline uint64_t parse_number(const char *end) {
uint64_t num = 0; uint64_t num = 0;
for (size_t n = 1;; n *= 10) { for (size_t n = 1;; n *= 10) {

View File

@ -5,7 +5,7 @@
#include <stdint.h> #include <stdint.h>
int64_t parse_number(char *end); inline int64_t parse_number(const char *end);
int main(int argc, char **argv) { int main(int argc, char **argv) {
@ -69,7 +69,7 @@ int main(int argc, char **argv) {
return 0; return 0;
} }
int64_t parse_number(char *end) { inline int64_t parse_number(const char *end) {
int64_t num = 0; int64_t num = 0;
for (size_t m = 1;; m *= 10) { for (size_t m = 1;; m *= 10) {

View File

@ -5,7 +5,7 @@
#include <stdint.h> #include <stdint.h>
uint64_t parse_number(char *end); inline uint64_t parse_number(const char *end);
#define MAPS_LEN 7 #define MAPS_LEN 7
@ -100,7 +100,7 @@ int main(int argc, char **argv) {
return 0; return 0;
} }
uint64_t parse_number(char *end) { inline uint64_t parse_number(const char *end) {
uint64_t num = 0; uint64_t num = 0;
for (size_t m = 1;; m *= 10) { for (size_t m = 1;; m *= 10) {