Write a typo correction program with Levenshtein distance algorithm
I see very little space for improvements.

First, your min3 macro (btw, max is missing a closing bracket) will, in some cases, execute inside branching more than needed (i.e., if c &gt; min2(a,b)). I'd write it directly:

#define min3(a, b, c)   \
((a) &lt; (b) ? ((a) &lt; (c) ? (a) : (c)) : ((b) &lt; (c) ? (b) : (c)))


Second, this part:

for (size_t i = 1UL; i &lt;= nt; ++i) {
    char const cCol = t[i-1];
    d2[0UL]         = i;


can save one subtraction:

for (size_t i = 0UL; i &lt; nt; ) {
    char const cCol = t[i];
    d2[0UL]         = ++i;


Maybe the inside loop can be made faster by using pointer arithmetic instead of indexing, but I'm not sure. So, you can try replacing

    for (size_t j = 1UL; j &lt;= ns; ++j) {
        int    const nCost = s[j-1] != cCol;
        size_t const i1    = d1[j  ] + 1;
        size_t const i2    = d2[j-1] + 1;
        size_t const i3    = d1[j-1] + nCost; 
        d2[j] = min3(i1, i2, i3);
    }


with

    size_t *d1j = d1+1, *d2j1 = d2, *d1j1 = d1;
    for (size_t j = 1UL; j &lt;= ns; ++j) {
        int    const nCost = s[j-1] != cCol;
        size_t const i1    = *d1j + 1;
        size_t const i2    = *d2j1 + 1;
        size_t const i3    = *d1j1 + nCost; 
        *d2j = min3(i1, i2, i3);
        d1j1 = d1j++;
        d2j1++;
    }