orsinium-labs / intover

Golang package for integer arithmetic with overflow detection.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

intover

Golang package for integer arithmetic with overflow detection.

Based on overflow package.

Features:

  • Generics.
  • Small and simple API.
  • Can return ok or can panic.

Installation

go get github.com/orsinium-labs/intover

Usage

result, ok := intover.Do(a, '+', b)

Or the same:

result, ok := intover.Add(a, b)

Or if you want it to panic on overflow:

result := intover.Must(intover.Add(a, b))

About

Golang package for integer arithmetic with overflow detection.

License:MIT License


Languages

Language:Go 100.0%