Switch storage in YGStyle
to CompactValue
Summary: @public Switches the storage in `facebook::yoga::detail::Values` from `YGValue` to `facebook::yoga::detail::CompactValue`. This cuts heap size for arrays of values in half. Reviewed By: SidharthGuglani Differential Revision: D13465586 fbshipit-source-id: 49a4d6d29a73bdd44843b1f3c57bf746050c94d6
This commit is contained in:
committed by
Facebook Github Bot
parent
8461aeaef0
commit
885b4cbdfb
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <yoga/YGValue.h>
|
||||
#include "YGValue.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
@@ -73,6 +73,10 @@ class CompactValue {
|
||||
return std::isnan(value) ? ofUndefined() : of<Unit>(value);
|
||||
}
|
||||
|
||||
static constexpr CompactValue ofZero() noexcept {
|
||||
return CompactValue{Payload{ZERO_BITS_POINT}};
|
||||
}
|
||||
|
||||
static constexpr CompactValue ofUndefined() noexcept {
|
||||
return CompactValue{};
|
||||
}
|
||||
|
Reference in New Issue
Block a user