diff --git a/ReactCommon/yoga/yoga/YGValue.h b/ReactCommon/yoga/yoga/YGValue.h index 2395e07c0..170047ea5 100644 --- a/ReactCommon/yoga/yoga/YGValue.h +++ b/ReactCommon/yoga/yoga/YGValue.h @@ -54,4 +54,30 @@ inline bool operator!=(const YGValue& lhs, const YGValue& rhs) { return !(lhs == rhs); } +inline YGValue operator-(const YGValue& value) { + return {-value.value, value.unit}; +} + +namespace facebook { +namespace yoga { +namespace literals { + +inline YGValue operator"" _pt(long double value) { + return YGValue{static_cast(value), YGUnitPoint}; +} +inline YGValue operator"" _pt(unsigned long long value) { + return operator"" _pt(static_cast(value)); +} + +inline YGValue operator"" _percent(long double value) { + return YGValue{static_cast(value), YGUnitPercent}; +} +inline YGValue operator"" _percent(unsigned long long value) { + return operator"" _percent(static_cast(value)); +} + +} // namespace literals +} // namespace yoga +} // namespace facebook + #endif