Introduce CompactValue

Summary:
@public

`CompactValue` represents a `YGValue` in 32bits instead of 64. This comes at the cost of a range limitation, as one exponent bit is borrowed for the unit.

*Undefined* and *Auto* have no magnitude, and are represented as *NaN* values.

The data structure is meant to be used as a field type on `YGStyle` to save memory.

This is header-only for efficient inlining.

Reviewed By: jackerghan, aCorrado

Differential Revision: D13187211

fbshipit-source-id: 16e3ffad592e38e2493e4f7c8b952d372e449846
This commit is contained in:
David Aurelio
2018-12-14 09:20:27 -08:00
committed by Facebook Github Bot
parent c5f2444048
commit 8bc89651d6
3 changed files with 533 additions and 0 deletions

2
BUCK
View File

@@ -20,6 +20,7 @@ TEST_COMPILER_FLAGS = BASE_COMPILER_FLAGS + GMOCK_OVERRIDE_FLAGS + [
yoga_cxx_library(
name = "yoga",
srcs = glob(["yoga/*.cpp"]),
headers = subdir_glob([("", "yoga/**/*.h")]),
header_namespace = "",
exported_headers = subdir_glob([("", "yoga/*.h")]),
compiler_flags = COMPILER_FLAGS,
@@ -34,6 +35,7 @@ yoga_cxx_library(
yoga_cxx_test(
name = "YogaTests",
srcs = glob(["tests/*.cpp"]),
headers = subdir_glob([("", "yoga/**/*.h")]),
compiler_flags = TEST_COMPILER_FLAGS,
contacts = ["emilsj@fb.com"],
visibility = ["PUBLIC"],