So the solution I came up with is to use the observation that the “array of const” is “array of TVarRec”, and that “array of TVarRec” is passed as as two arguments: a pointer to the data and the length of the array (or rather, the highest index in the array).
I’ve been using cURL but always had a feeling not to its potential basically because the cURL man page [WayBack] is both massive and lacks concrete useful practical examples.
For instance, I knew about the --header and --verbose options (I always use verbose names even though shorter -H and -v exist) to pass a specific header and get verbose output, but the man page basic examples like this by Tader:
Besides the optimised versions of these functions, I learned the most from these comments:
The DivMod should be faster. Should really be a single division. The CPU instruction will give you both div and mod from a single instruction. No point doing the divide twice.
It was back in the days when lots of new things in the Delphi world were happening: Delphi 2 – the first 32-bit version – came out half a year before and the upcoming Delphi 3 was going to be a game changer as well. New features were rock solid and sales were booming.
A while ago, I had to fix some stuff in an application that would write – using a binary mechanism – UTF-8 and UTF-16 strings (part of it XML in various flavours) to the same byte stream without converting between the two encodings.
Some links that helped me investigate what was wrong, choose what encoding to use for storage and fix it:
The issue was caused by the Windows LoadLibrary trying to optimise loading which backfired for libraries (PE files like DLL/EXE…) that have multiple import tables in them as generated by the Delphi and C++ Builder linker (and maybe other linkers as well).
Microsoft finetuned their optimisation whereas a future update to Delphi and C++ Builder will generate more optimised import tables.