From: Kevin Day Date: Wed, 6 Mar 2024 02:01:14 +0000 (-0600) Subject: Update: Switch for..loop with memcpy() for character width copies. X-Git-Tag: 0.6.10~23 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=2d7302c9d33e41dc9bdfbaac4adf78f00ae7d3e0;p=fll Update: Switch for..loop with memcpy() for character width copies. --- diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index 17d4bee..4c190df 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -903,9 +903,9 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; ++i) { - destination->string[destination->used++] = object.string[range->start + i]; - } // for + memcpy(destination->string + destination->used, object.string + range->start, width); + + destination->used += width; } } @@ -982,9 +982,9 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; ++i) { - destination->string[destination->used++] = object.string[range->start + i]; - } // for + memcpy(destination->string + destination->used, object.string + range->start, width); + + destination->used += width; } status = f_utf_buffer_increment(object, range, 1); diff --git a/level_1/fl_fss/c/fss/embedded_list.c b/level_1/fl_fss/c/fss/embedded_list.c index fc53776..3a1ef95 100644 --- a/level_1/fl_fss/c/fss/embedded_list.c +++ b/level_1/fl_fss/c/fss/embedded_list.c @@ -1350,9 +1350,9 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; ++i) { - destination->string[destination->used++] = object.string[range->start + i]; - } // for + memcpy(destination->string + destination->used, object.string + range->start, width); + + destination->used += width; } } @@ -1444,9 +1444,9 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; ++i) { - destination->string[destination->used++] = object.string[range->start + i]; - } // for + memcpy(destination->string + destination->used, object.string + range->start, width); + + destination->used += width; } status = f_utf_buffer_increment(object, range, 1); diff --git a/level_1/fl_fss/c/fss/extended_list.c b/level_1/fl_fss/c/fss/extended_list.c index 34f88b6..3eb8050 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -918,9 +918,9 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; ++i) { - destination->string[destination->used++] = object.string[range->start + i]; - } // for + memcpy(destination->string + destination->used, object.string + range->start, width); + + destination->used += width; } } @@ -1012,9 +1012,9 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; ++i) { - destination->string[destination->used++] = object.string[range->start + i]; - } // for + memcpy(destination->string + destination->used, object.string + range->start, width); + + destination->used += width; } status = f_utf_buffer_increment(object, range, 1); diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index 1de3a7d..506e0f0 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -916,9 +916,9 @@ extern "C" { destination->string[destination->used++] = quote_char; - for (i = 0; i < width; ++i) { - destination->string[destination->used++] = object.string[range->start + i]; - } // for + memcpy(destination->string + destination->used, object.string + range->start, width); + + destination->used += width; } else if ((flag & 0x1) && object.string[range->start] == f_fss_comment_s.string[0]) { @@ -964,9 +964,9 @@ extern "C" { destination->string[destination->used++] = f_fss_delimit_slash_s.string[0]; } // for - for (i = 0; i < width; ++i) { - destination->string[destination->used++] = object.string[range->start + i]; - } // for + memcpy(destination->string + destination->used, object.string + range->start, width); + + destination->used += width; } } else if (object.string[range->start] == quote_char) { @@ -1031,9 +1031,9 @@ extern "C" { destination->string[destination->used++] = quote_char; - for (i = 0; i < width; ++i) { - destination->string[destination->used++] = object.string[range->start + i]; - } // for + memcpy(destination->string + destination->used, object.string + range->start, width); + + destination->used += width; } else if (object.string[range->start] == f_fss_eol_s.string[0]) { status = F_status_set_error(F_none_eol); @@ -1055,9 +1055,9 @@ extern "C" { status = f_string_dynamic_increase_by(width, destination); if (F_status_is_error(status)) break; - for (i = 0; i < width; ++i) { - destination->string[destination->used++] = object.string[range->start + i]; - } // for + memcpy(destination->string + destination->used, object.string + range->start, width); + + destination->used += width; } status = f_utf_buffer_increment(object, range, 1);