Encoding: Reformulate to avoid unsigned int overflow
Playing with clang UBSan unsigned-integer-overflow I found just 2 warnings in KWSys.
They are not undefined behavior, but often unintentional.
A reformulation to avoid the overflow was pretty straightforward.
Also noticed and changed &v[0] idiom to v.data().
Edited by Brad King