Convert GRAPHEME_STATE to uint_least16_t and remove it

I was never quite happy with the fact that the internal state-struct
was visible in the grapheme.h-header, given the declaration of the
fields only namely served internal purposes and were useless noise to
the reader.

To keep it in was merely a choice made because I had always hoped
to be able to implement maybe a few more state-based pairwise
segmentation check functions and use the GRAPHEME_STATE type in more
places, but now after implementing the algorithms it becomes clear that
they all do not satisfy these pairwise semantics.

The first logical step was to convert the struct to an uint_least16_t,
which provides enough space (at least 16 bits) to store all the complete
state, and have internal deserialiation and serialization functions.

The remaining question was if the

	typedef uint_least16_t GRAPHEME_STATE

should be removed. I took inspiration from the Linux kernel coding
style[0], which in section 5b lays out the exact case of typedeffing
an integer that is meant to store flags (just like in our case).
It is argued there that there needs to be a good reason to typedef an
integer (e.g. given it might change by architecture or maybe change in
later versions). Both cases are not given here (we will _never_ need
more than 16 bits to store the grapheme cluster break state and you can
even reduce more wastage, e.g. for storing the prop which never exceeds
4 bits given NUM_CHAR_BREAK_PROPS == 14 < 15 == 2^4-1), and I must admit
that it improves readability a bit given you finally know what you're
dealing with.

The expression

	GRAPHEME_STATE state = 0;

admittedly looks a little fishy, given you don't really know what happens
behind the scenes unless you look in the header, and I want all of the
semantics to be crystal clear to the end-user.

[0]:https://www.kernel.org/doc/html/latest/process/coding-style.html#typedefs

Signed-off-by: Laslo Hunhold <dev@frign.de>
4 files changed