Fix undefined behavior in ll2string().

The bug was found by @CAFxX, thanks!
See issue #1940.