Copyright | (C) 2013-2015, University of Twente |
---|---|

License | BSD2 (see the file LICENSE) |

Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |

Safe Haskell | Trustworthy |

Language | Haskell2010 |

- data Unsigned n

# Documentation

Arbitrary-width unsigned integer represented by `n`

bits

Given `n`

bits, an `Unsigned`

`n`

number has a range of: [0 .. 2^`n`

-1]

**NB**: The `Num`

operators perform `wrap-around`

on overflow. If you want
saturation on overflow, check out the `SaturatingNum`

class.

`>>>`

7`maxBound :: Unsigned 3`

`>>>`

0`minBound :: Unsigned 3`

`>>>`

3`1 + 2 :: Unsigned 3`

`>>>`

0`2 + 6 :: Unsigned 3`

`>>>`

6`1 - 3 :: Unsigned 3`

`>>>`

6`2 * 3 :: Unsigned 3`

`>>>`

0`2 * 4 :: Unsigned 3`

`>>>`

8`(2 :: Unsigned 3) `times` (4 :: Unsigned 3) :: Unsigned 6`

`>>>`

8`(2 :: Unsigned 3) `plus` (6 :: Unsigned 3) :: Unsigned 4`

`>>>`

7`satPlus SatSymmetric 2 6 :: Unsigned 3`

`>>>`

0`satMin SatSymmetric 2 3 :: Unsigned 3`