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
25 lines
576 B
Java
25 lines
576 B
Java
/**
|
|
* 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.
|
|
*/
|
|
package com.facebook.yoga;
|
|
|
|
public class YogaConstants {
|
|
|
|
public static final float UNDEFINED = Float.NaN;
|
|
|
|
public static boolean isUndefined(float value) {
|
|
return Float.compare(value, UNDEFINED) == 0;
|
|
}
|
|
|
|
public static boolean isUndefined(YogaValue value) {
|
|
return value.unit == YogaUnit.UNDEFINED;
|
|
}
|
|
|
|
public static float getUndefined() {
|
|
return UNDEFINED;
|
|
}
|
|
}
|