Files
yoga/java/com/facebook/yoga/YogaMeasureOutput.java

33 lines
897 B
Java
Raw Normal View History

/*
* 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;
2014-09-18 15:15:21 -07:00
/**
* Helpers for building measure output value.
2014-09-18 15:15:21 -07:00
*/
public class YogaMeasureOutput {
2014-09-18 15:15:21 -07:00
public static long make(float width, float height) {
final int wBits = Float.floatToRawIntBits(width);
final int hBits = Float.floatToRawIntBits(height);
return ((long) wBits) << 32 | ((long) hBits);
}
public static long make(int width, int height) {
return make((float) width, (float) height);
}
public static float getWidth(long measureOutput) {
return Float.intBitsToFloat((int) (0xFFFFFFFF & (measureOutput >> 32)));
}
public static float getHeight(long measureOutput) {
return Float.intBitsToFloat((int) (0xFFFFFFFF & measureOutput));
}
2014-09-18 15:15:21 -07:00
}