Skip to content
Snippets Groups Projects
Commit 3083290a authored by LJ Sonic's avatar LJ Sonic
Browse files

Add READSTRINGL and WRITESTRINGL macros

parent a6685460
No related branches found
No related tags found
No related merge requests found
...@@ -160,6 +160,15 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr) ...@@ -160,6 +160,15 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
WRITECHAR(p, '\0'); \ WRITECHAR(p, '\0'); \
}) })
#define WRITESTRINGL(p, s, n) ({ \
size_t tmp_i; \
\
for (tmp_i = 0; tmp_i < n - 1 && s[tmp_i] != '\0'; tmp_i++) \
WRITECHAR(p, s[tmp_i]); \
\
WRITECHAR(p, '\0'); \
})
#define WRITESTRING(p, s) ({ \ #define WRITESTRING(p, s) ({ \
size_t tmp_i; \ size_t tmp_i; \
\ \
...@@ -192,6 +201,15 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr) ...@@ -192,6 +201,15 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
s[tmp_i] = '\0'; \ s[tmp_i] = '\0'; \
}) })
#define READSTRINGL(p, s, n) ({ \
size_t tmp_i = 0; \
\
while (tmp_i < n - 1 && (s[tmp_i] = READCHAR(p)) != '\0') \
tmp_i++; \
\
s[tmp_i] = '\0'; \
})
#define READSTRING(p, s) ({ \ #define READSTRING(p, s) ({ \
size_t tmp_i = 0; \ size_t tmp_i = 0; \
\ \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment