MCPcopy Create free account
hub / github.com/OpenTSDB/opentsdb / floatingPointValueToFix

Method floatingPointValueToFix

src/core/Internal.java:556–561  ·  view source on GitHub ↗

Returns whether or not this is a floating value that needs to be fixed. OpenTSDB used to encode all floating point values as `float' (4 bytes) but actually store them on 8 bytes, with 4 leading 0 bytes, and flags correctly stating the value was on 4 bytes. (from CompactionQueue) @param flags The

(final byte flags,
                                                 final byte[] value)

Source from the content-addressed store, hash-verified

554 * @param value The value that may need to be corrected.
555 */
556 public static boolean floatingPointValueToFix(final byte flags,
557 final byte[] value) {
558 return (flags & Const.FLAG_FLOAT) != 0 // We need a floating point value.
559 && (flags & Const.LENGTH_MASK) == 0x3 // That pretends to be on 4 bytes.
560 && value.length == 8; // But is actually using 8 bytes.
561 }
562
563 /**
564 * Returns a corrected value if this is a floating point value to fix.

Callers 4

checkForFixupMethod · 0.95
fixFloatingPointValueMethod · 0.95

Calls

no outgoing calls

Tested by 2