[hvgl] Simplify Align<>

This commit is contained in:
Behdad Esfahbod committed 2025-03-02 16:57:54 -07:00
1 parent a6ba9603c9
commit e9c531dcbf
2 files changed
+6 -4

No files matched your search

+1 -2
View File
@@ -104,9 +104,8 @@ struct PartShape
if (unlikely (!blendTypes.sanitize (c, segmentCount))) return_trace (false);
const auto &padding = StructAfter<decltype (paddingX)> (blendTypes, segmentCount);
unsigned offset = (const char *) &padding - (const char *) this;
const auto &coordinates = StructAfter<decltype (coordinatesX)> (padding, offset);
const auto &coordinates = StructAfter<decltype (coordinatesX)> (padding, this);
if (unlikely (!coordinates.sanitize (c, segmentCount))) return_trace (false);
const auto &deltas = StructAfter<decltype (deltasX)> (coordinates, axisCount, segmentCount);
+5 -2
View File
@@ -2057,8 +2057,11 @@ struct TupleList : CFF2Index
template <unsigned int alignment>
struct Align
{
unsigned get_size (unsigned offset) const
{ return (offset + alignment - 1) & ~(alignment - 1); }
unsigned get_size (const void *base) const
{
unsigned offset = (const char *) this - (const char *) base;
return (offset + alignment - 1) & ~(alignment - 1);
}
public:
DEFINE_SIZE_MIN (0);