Roll back -ffast-math

Summary:
@public

`-ffast-math` does not have measurable performance benefits.

By using `NaN` for *undefined* values again, we can squeeze `YGFloatOptional` into 32 bits.
This will also enable us to store `YGValue` (or a variant of it) in 32 bits.

Reviewed By: astreet

Differential Revision: D13403925

fbshipit-source-id: b13d026bf556f24ab4699e65fb450af13a70961b
This commit is contained in:
David Aurelio
2018-12-13 07:09:28 -08:00
committed by Facebook Github Bot
parent 8ab01fde6e
commit 9ddda3c630
7 changed files with 21 additions and 77 deletions

View File

@@ -17,14 +17,13 @@
#include <stdbool.h>
#endif
/** Large positive number signifies that the property(float) is undefined.
*Earlier we used to have YGundefined as NAN, but the downside of this is that
*we can't use -ffast-math compiler flag as it assumes all floating-point
*calculation involve and result into finite numbers. For more information
*regarding -ffast-math compiler flag in clang, have a look at
*https://clang.llvm.org/docs/UsersManual.html#cmdoption-ffast-math
**/
#define YGUndefined 10E20F
// Not defined in MSVC++
#ifndef NAN
static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
#define NAN (*(const float*)__nan)
#endif
#define YGUndefined NAN
#include "YGEnums.h"
#include "YGMacros.h"