commit 52a25d52f16697e74dfd582217de5d169c3790cb
Author: Laslo Hunhold <[email protected]>
AuthorDate: Thu May 28 19:32:01 2020 +0200
Commit: Laslo Hunhold <[email protected]>
CommitDate: Thu May 28 19:32:01 2020 +0200
Optimize the bit extraction a bit
Thanks Mattias for the suggestion!
Signed-off-by: Laslo Hunhold <[email protected]>
diff --git a/src/codepoint.c b/src/codepoint.c
index 8e69151..e20fdf5 100644
--- 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;
}
}