From 8dc46c0a8774afa78a090dadffeddb77a634cb4a Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 16 May 2019 11:42:31 -0700 Subject: [PATCH] `YGNode`: one byte of private storage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Adds one byte of private storage to `YGNode`, intended to be used by Yoga itself. This is in previously unused alignment space, and won’t cause more memory to be allocated. Reviewed By: SidharthGuglani Differential Revision: D15296732 fbshipit-source-id: 3caf0a3cd506e4e324e51c31869c69be5781d476 --- yoga/YGNode.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yoga/YGNode.h b/yoga/YGNode.h index e43dc9d8..bbd1b703 100644 --- a/yoga/YGNode.h +++ b/yoga/YGNode.h @@ -5,6 +5,7 @@ * file in the root directory of this source tree. */ #pragma once +#include #include #include "CompactValue.h" #include "YGConfig.h" @@ -27,6 +28,7 @@ private: bool measureUsesContext_ : 1; bool baselineUsesContext_ : 1; bool printUsesContext_ : 1; + uint8_t reserved_ = 0; union { YGMeasureFunc noContext; MeasureWithContextFn withContext; @@ -91,6 +93,9 @@ public: // Getters void* getContext() const { return context_; } + uint8_t& reserved() { return reserved_; } + uint8_t reserved() const { return reserved_; } + void print(void*); bool getHasNewLayout() const { return hasNewLayout_; }