num

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package num narrows integers for the wire, saturating rather than wrapping.

Most of what agni narrows is a count or a coordinate read off a design file, and a design file can come from anyone, a dropped file in the browser demo included. A plain int32(n) of a value past the range wraps to a number with the wrong sign, which reads as a real answer. Saturating keeps the value at the end of the range it overflowed, so it is still the largest or smallest a field can say.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int32

func Int32[T ~int | ~int64](v T) int32

Int32 narrows v to an int32, holding it at math.MaxInt32 or math.MinInt32 when it is out of range.

func Int64

func Int64(v uint64) int64

Int64 converts an unsigned count such as a runtime.MemStats field to an int64, holding it at math.MaxInt64 when it is out of range.

func Uint32

func Uint32[T ~int | ~int64](v T) uint32

Uint32 converts a count such as a slice length to a uint32, holding it at 0 or math.MaxUint32 when it is out of range.

Types

This section is empty.

Jump to

Keyboard shortcuts

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