Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/orsinium-labs/intover

Golang package for integer arithmetic with overflow detection.
https://github.com/orsinium-labs/intover

arithmetic go golang integer-arithmetic integer-overflow overflow overflow-detection

Last synced: about 2 months ago
JSON representation

Golang package for integer arithmetic with overflow detection.

Awesome Lists containing this project

README

        

# intover

Golang package for integer arithmetic with overflow detection.

Based on [overflow](https://github.com/JohnCGriffin/overflow) package.

Features:

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

## Installation

```bash
go get github.com/orsinium-labs/intover
```

## Usage

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

Or the same:

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

Or if you want it to panic on overflow:

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