[layout] Add large_int to Types

This commit is contained in:
Behdad Esfahbod 2022-07-21 10:30:23 -06:00
parent bababe1072
commit 02ca025443
2 changed files with 5 additions and 3 deletions

View File

@ -67,10 +67,10 @@ struct CoverageFormat2_4
unsigned get_population () const
{
unsigned ret = 0;
typename Types::large_int ret = 0;
for (const auto &r : rangeRecord)
ret += r.get_population (); // TODO Overflow
return ret;
ret += r.get_population ();
return ret > UINT_MAX ? UINT_MAX : (unsigned) ret;
}
template <typename Iterator,

View File

@ -34,6 +34,7 @@ namespace Layout {
struct SmallTypes {
static constexpr unsigned size = 2;
using large_int = uint32_t;
using HBUINT = HBUINT16;
using HBGlyphID = HBGlyphID16;
using Offset = Offset16;
@ -47,6 +48,7 @@ struct SmallTypes {
struct MediumTypes {
static constexpr unsigned size = 3;
using large_int = uint64_t;
using HBUINT = HBUINT24;
using HBGlyphID = HBGlyphID24;
using Offset = Offset24;