From: Mark Wooding Date: Wed, 14 Oct 2015 10:00:51 +0000 (+0100) Subject: math/mptext.c: Radically refactor `mp_read'. X-Git-Tag: 2.2.1~6 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/catacomb/commitdiff_plain/a6b6ae6baba64bf876bac6e4d34b364035666183?hp=a6b6ae6baba64bf876bac6e4d34b364035666183 math/mptext.c: Radically refactor `mp_read'. It used to be the largest function in the library -- possibly in my codebase. * Split it into three main pieces: the special-purpose binary reader, an efficient stack-based general-radix reader, and a high-level syntax parser which picks out signs and base indicators. This removes the complicated entangling of the base indicator parsing with the general-radix reader which was the worst feature of the old version. * Split commonly-used functionality out into separate functions, notably `char_digit' and `read_digit'. The result is code which is easier to understand and actually shorter. ---