Search Results for

    Show / Hide Table of Contents

    Converter.ZigZagDecode Method

    Namespace: Riptide.Utils
    Assembly: RiptideNetworking.dll

    Overloads

    ZigZagDecode(int)

    Zig zag decodes value.

    ZigZagDecode(long)

    Zig zag decodes value.

    ZigZagDecode(int)

    Zig zag decodes value.

    public static int ZigZagDecode(int value)

    Parameters

    int value

    The value to decode.

    Returns

    int

    The zig zag-decoded value.

    Remarks

    Zig zag encoding allows small negative numbers to be represented as small positive numbers. All positive numbers are doubled and become even numbers, while all negative numbers become positive odd numbers. In contrast, simply casting a negative value to its unsigned counterpart would result in a large positive number which uses the high bit, rendering compression via AddVarULong(ulong) and GetVarULong() ineffective.

    ZigZagDecode(long)

    Zig zag decodes value.

    public static long ZigZagDecode(long value)

    Parameters

    long value

    The value to decode.

    Returns

    long

    The zig zag-decoded value.

    Remarks

    Zig zag encoding allows small negative numbers to be represented as small positive numbers. All positive numbers are doubled and become even numbers, while all negative numbers become positive odd numbers. In contrast, simply casting a negative value to its unsigned counterpart would result in a large positive number which uses the high bit, rendering compression via AddVarULong(ulong) and GetVarULong() ineffective.

    • Improve this Doc
    • View Source
    • Support Riptide
    In This Article
    Back to top Copyright © Tom Weiland 2022
    Made with DocFX