libgrapheme

Freestanding C library for unicode string handling
git clone https://git.sinitax.com/suckless/libgrapheme
Log | Files | Refs | README | LICENSE | sfeed.txt

commit 52a25d52f16697e74dfd582217de5d169c3790cb
parent a92d6a756cb1dfc45fe29e68d56fab18bd482c90
Author: Laslo Hunhold <dev@frign.de>
Date:   Thu, 28 May 2020 19:32:01 +0200

Optimize the bit extraction a bit

Thanks Mattias for the suggestion!

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

Diffstat:
Msrc/codepoint.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/codepoint.c b/src/codepoint.c @@ -58,9 +58,9 @@ grapheme_cp_decode(uint32_t *cp, const uint8_t *s, size_t n) /* * first byte is within the bounds; fill * p with the the first bits contained in - * the first byte ("upper-lower" is the bitmask) + * the first byte (by subtracting the high bits) */ - *cp = s[0] & (lut[off].upper - lut[off].lower); + *cp = s[0] - lut[off].lower; break; } }