Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise FlashString iteration and indexing #2761

Merged
merged 2 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Sming/Arch/Esp32/Components/libc/src/include/sys/pgmspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ extern "C" {
#define pgm_read_dword_far(addr) pgm_read_dword(addr)
#define pgm_read_float_far(addr) pgm_read_float(addr)

#define memcpy_P(dest, src, num) memcpy(dest, src, num)
#define memcmp_P(a1, b1, len) memcmp(a1, b1, len)
#define strlen_P(a) strlen(a)
#define strcpy_P(dest, src) strcpy(dest, src)
#define strncpy_P(dest, src, size) strncpy(dest, src, size)
#define strcmp_P(a, b) strcmp(a, b)
#define memcpy_P(dest, src_P, num) memcpy(dest, src_P, num)
#define memcmp_P(buf1, buf2_P, len) memcmp(buf1, buf2_P, len)
#define strlen_P(str_P) strlen(str_P)
#define strcpy_P(dest, src_P) strcpy(dest, src_P)
#define strncpy_P(dest, src_P, size) strncpy(dest, src_P, size)
#define strcmp_P(str1, str2_P) strcmp(str1, str2_P)
#define strncmp_P(str1, str2_P, size) strncmp(str1, str2_P, size)
#define strcasecmp_P(a, b) strcasecmp(a, b)
#define strcat_P(dest, src) strcat(dest, src)
#define strstr_P(a, b) strstr(a, b)
#define sprintf_P(s, f, ...) m_snprintf(s, 1024, f, ##__VA_ARGS__)
#define strcasecmp_P(str1, str2_P) strcasecmp(str1, str2_P)
#define strcat_P(dest, src_P) strcat(dest, src_P)
#define strstr_P(haystack, needle_P) strstr(haystack, needle_P)
#define sprintf_P(str, format_P, ...) m_snprintf(str, 1024, format_P, ##__VA_ARGS__)

#ifdef __cplusplus
}
Expand Down
20 changes: 10 additions & 10 deletions Sming/Arch/Esp8266/Components/libc/include/sys/pgmspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,16 @@ static inline uint16_t pgm_read_word_inlined(const void* addr)
* @{
*/

void* memcpy_P(void* dest, const void* src_P, size_t length);
int memcmp_P(const void* a1, const void* b1, size_t len);
size_t strlen_P(const char* src_P);
char* strcpy_P(char* dest, const char* src_P);
char* strncpy_P(char* dest, const char* src_P, size_t size);
int strcmp_P(const char* str1, const char* str2_P);
int strncmp_P(const char* str1, const char* str2_P, const size_t size);
int strcasecmp_P(const char* str1, const char* str2_P);
char* strcat_P(char* dest, const char* src_P);
char* strstr_P(char* haystack, const char* needle_P);
void* memcpy_P(void* dest, PGM_VOID_P src_P, size_t length);
int memcmp_P(const void* buf1, PGM_VOID_P buf2_P, size_t len);
size_t strlen_P(PGM_VOID_P src_P);
char* strcpy_P(char* dest, PGM_P src_P);
char* strncpy_P(char* dest, PGM_P src_P, size_t size);
int strcmp_P(const char* str1, PGM_P str2_P);
int strncmp_P(const char* str1, PGM_P str2_P, const size_t size);
int strcasecmp_P(const char* str1, PGM_P str2_P);
char* strcat_P(char* dest, PGM_P src_P);
char* strstr_P(char* haystack, PGM_P needle_P);

#define sprintf_P(s, f_P, ...) \
(__extension__({ \
Expand Down
20 changes: 10 additions & 10 deletions Sming/Arch/Host/Components/libc/include/sys/pgmspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ bool isFlashPtr(const void* ptr);
#define pgm_read_dword_far(addr) pgm_read_dword(addr)
#define pgm_read_float_far(addr) pgm_read_float(addr)

#define memcpy_P(dest, src, num) memcpy(dest, src, num)
#define memcmp_P(a1, b1, len) memcmp(a1, b1, len)
#define strlen_P(a) strlen(a)
#define strcpy_P(dest, src) strcpy(dest, src)
#define strncpy_P(dest, src, size) strncpy(dest, src, size)
#define strcmp_P(a, b) strcmp(a, b)
#define memcpy_P(dest, src_P, num) memcpy(dest, src_P, num)
#define memcmp_P(buf1, buf2_P, len) memcmp(buf1, buf2_P, len)
#define strlen_P(str_P) strlen(str_P)
#define strcpy_P(dest, src_P) strcpy(dest, src_P)
#define strncpy_P(dest, src_P, size) strncpy(dest, src_P, size)
#define strcmp_P(str1, str2_P) strcmp(str1, str2_P)
#define strncmp_P(str1, str2_P, size) strncmp(str1, str2_P, size)
#define strcasecmp_P(a, b) strcasecmp(a, b)
#define strcat_P(dest, src) strcat(dest, src)
#define strstr_P(a, b) strstr(a, b)
#define sprintf_P(s, f, ...) m_snprintf(s, 1024, f, ##__VA_ARGS__)
#define strcasecmp_P(str1, str2_P) strcasecmp(str1, str2_P)
#define strcat_P(dest, src_P) strcat(dest, src_P)
#define strstr_P(haystack, needle_P) strstr(haystack, needle_P)
#define sprintf_P(str, format_P, ...) m_snprintf(str, 1024, format_P, ##__VA_ARGS__)

#ifdef __cplusplus
}
Expand Down
20 changes: 10 additions & 10 deletions Sming/Arch/Rp2040/Components/libc/src/include/sys/pgmspace.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ extern "C" {
#define pgm_read_dword_far(addr) pgm_read_dword(addr)
#define pgm_read_float_far(addr) pgm_read_float(addr)

#define memcpy_P(dest, src, num) memcpy(dest, src, num)
#define memcmp_P(a1, b1, len) memcmp(a1, b1, len)
#define strlen_P(a) strlen(a)
#define strcpy_P(dest, src) strcpy(dest, src)
#define strncpy_P(dest, src, size) strncpy(dest, src, size)
#define strcmp_P(a, b) strcmp(a, b)
#define memcpy_P(dest, src_P, num) memcpy(dest, src_P, num)
#define memcmp_P(buf1, buf2_P, len) memcmp(buf1, buf2_P, len)
#define strlen_P(str_P) strlen(str_P)
#define strcpy_P(dest, src_P) strcpy(dest, src_P)
#define strncpy_P(dest, src_P, size) strncpy(dest, src_P, size)
#define strcmp_P(str1, str2_P) strcmp(str1, str2_P)
#define strncmp_P(str1, str2_P, size) strncmp(str1, str2_P, size)
#define strcasecmp_P(a, b) strcasecmp(a, b)
#define strcat_P(dest, src) strcat(dest, src)
#define strstr_P(a, b) strstr(a, b)
#define sprintf_P(s, f, ...) m_snprintf(s, 1024, f, ##__VA_ARGS__)
#define strcasecmp_P(str1, str2_P) strcasecmp(str1, str2_P)
#define strcat_P(dest, src_P) strcat(dest, src_P)
#define strstr_P(haystack, needle_P) strstr(haystack, needle_P)
#define sprintf_P(str, format_P, ...) m_snprintf(str, 1024, format_P, ##__VA_ARGS__)

#ifdef __cplusplus
}
Expand Down
Loading