summaryrefslogtreecommitdiffstats
path: root/t/recipes/checks/cruft/cruft-non-free-utf/build-spec/orig/src/bad.c
diff options
context:
space:
mode:
Diffstat (limited to 't/recipes/checks/cruft/cruft-non-free-utf/build-spec/orig/src/bad.c')
-rw-r--r--t/recipes/checks/cruft/cruft-non-free-utf/build-spec/orig/src/bad.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/recipes/checks/cruft/cruft-non-free-utf/build-spec/orig/src/bad.c b/t/recipes/checks/cruft/cruft-non-free-utf/build-spec/orig/src/bad.c
new file mode 100644
index 0000000..753e63a
--- /dev/null
+++ b/t/recipes/checks/cruft/cruft-non-free-utf/build-spec/orig/src/bad.c
@@ -0,0 +1,18 @@
+/* ---------------------------------------------------------------------
+
+ Note A.
+ The fall-through switches in UTF-8 reading code save a
+ temp variable, some decrements & conditionals. The switches
+ are equivalent to the following loop:
+ {
+ int tmpBytesToRead = extraBytesToRead+1;
+ do {
+ ch += *source++;
+ --tmpBytesToRead;
+ if (tmpBytesToRead) ch <<= 6;
+ } while (tmpBytesToRead > 0);
+ }
+ In UTF-8 writing code, the switches on "bytesToWrite" are
+ similarly unrolled loops.
+
+ --------------------------------------------------------------------- */