uintconv

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package uintconv provides one-to-one mappings between unsigned integers and signed integers or floating-point numbers, so that the encoding and decoding functions for unsigned integers can be applied to signed integers and floating-point numbers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromFloat64ByteReversal

func FromFloat64ByteReversal(f float64) uint64

FromFloat64ByteReversal maps a 64-bit floating-point number to a 64-bit unsigned integer.

It converts the specified float64 to uint64 using math.Float64bits and then returns the byte-reversal of that uint64.

It satisfies:

FromFloat64ByteReversal(ToFloat64ByteReversal(x)) == x.

func FromInt64Zigzag

func FromInt64Zigzag(i int64) uint64

FromInt64Zigzag maps a 64-bit signed integer to a 64-bit unsigned integer with zigzag encoding.

FromInt64Zigzag(ToInt64Zigzag(x)) == x.

func ToFloat64ByteReversal

func ToFloat64ByteReversal(u uint64) float64

ToFloat64ByteReversal maps a 64-bit unsigned integer back to a 64-bit floating-point number.

It converts the byte-reversal of the specified uint64 to float64 using math.Float64frombits.

It satisfies:

ToFloat64ByteReversal(FromFloat64ByteReversal(x)) == x.

func ToInt64Zigzag

func ToInt64Zigzag(u uint64) int64

ToInt64Zigzag maps a 64-bit unsigned integer back to a 64-bit signed integer with zigzag encoding.

ToInt64Zigzag(FromInt64Zigzag(x)) == x.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL