Move out YGValue

Summary:
@public

Creates a single header file for `YGValue`. This is in preparation of a more compact representation of `YGValue` within `YGStyle`.

Also fixes the incorrect definition of NAN.

Reviewed By: SidharthGuglani

Differential Revision: D13172444

fbshipit-source-id: 4250dbcf8fe15ec3ecdee3913360a73bab633ce3
This commit is contained in:
David Aurelio
2018-12-06 07:35:08 -08:00
committed by Facebook Github Bot
parent 0962c5220c
commit d19da9e528
4 changed files with 70 additions and 44 deletions

40
yoga/YGValue.h Normal file
View File

@@ -0,0 +1,40 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*/
#pragma once
#include <math.h>
#include "YGEnums.h"
#include "YGMacros.h"
YG_EXTERN_C_BEGIN
// Not defined in MSVC++
#ifndef NAN
static const uint32_t __nan = 0x7fc00000;
#define NAN (*(const float*)__nan)
#endif
#define YGUndefined NAN
typedef struct YGValue {
float value;
YGUnit unit;
} YGValue;
extern const YGValue YGValueAuto;
extern const YGValue YGValueUndefined;
extern const YGValue YGValueZero;
YG_EXTERN_C_END
#ifdef __cplusplus
bool operator==(const YGValue& lhs, const YGValue& rhs);
bool operator!=(const YGValue& lhs, const YGValue& rhs);
#endif