Faster implementation of utf16_length