Skip to content

Golang package for integer arithmetic with overflow detection.

License

Notifications You must be signed in to change notification settings

orsinium-labs/intover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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))