java.lang.Object
de.haumacher.msgbuf.binary.BinaryUtil
Utilities for binary value encoding.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intzigzagDecode(int value) Decodes the result ofzigzagEncode(int)to its original signed value.static longzigzagDecode(long value) Decodes the result ofzigzagEncode(long)to its original signed value.static intzigzagEncode(int value) Zig-zag encodes the givenintproducing a small positive number for inputs with small absolute value.static longzigzagEncode(long value) Zig-zag encodes the givenlongproducing a small positive number for inputs with small absolute value.
-
Constructor Details
-
BinaryUtil
public BinaryUtil()
-
-
Method Details
-
zigzagEncode
public static int zigzagEncode(int value) Zig-zag encodes the givenintproducing a small positive number for inputs with small absolute value.- Parameters:
value- The value to encode.- Returns:
- The zig-zag encoded value.
-
zigzagEncode
public static long zigzagEncode(long value) Zig-zag encodes the givenlongproducing a small positive number for inputs with small absolute value.- Parameters:
value- The value to encode.- Returns:
- The zig-zag encoded value.
-
zigzagDecode
public static int zigzagDecode(int value) Decodes the result ofzigzagEncode(int)to its original signed value.- Parameters:
value- The value to decode.- Returns:
- The zig-zag decoded value.
-
zigzagDecode
public static long zigzagDecode(long value) Decodes the result ofzigzagEncode(long)to its original signed value.- Parameters:
value- The value to decode.- Returns:
- The zig-zag decoded value.
-