cleanup Ordinal (#13501)
This commit is contained in:
parent
42dad3a836
commit
6a0e87eb38
7 changed files with 36 additions and 10 deletions
|
|
@ -22,7 +22,7 @@ proc pred*[T: Ordinal](x: T, y = 1): T {.magic: "Pred", noSideEffect.}
|
|||
## echo pred(5) # => 4
|
||||
## echo pred(5, 3) # => 2
|
||||
|
||||
proc inc*[T: Ordinal|uint|uint64](x: var T, y = 1) {.magic: "Inc", noSideEffect.}
|
||||
proc inc*[T: Ordinal](x: var T, y = 1) {.magic: "Inc", noSideEffect.}
|
||||
## Increments the ordinal ``x`` by ``y``.
|
||||
##
|
||||
## If such a value does not exist, ``OverflowError`` is raised or a compile
|
||||
|
|
@ -33,7 +33,7 @@ proc inc*[T: Ordinal|uint|uint64](x: var T, y = 1) {.magic: "Inc", noSideEffect.
|
|||
## inc(i) # i <- 3
|
||||
## inc(i, 3) # i <- 6
|
||||
|
||||
proc dec*[T: Ordinal|uint|uint64](x: var T, y = 1) {.magic: "Dec", noSideEffect.}
|
||||
proc dec*[T: Ordinal](x: var T, y = 1) {.magic: "Dec", noSideEffect.}
|
||||
## Decrements the ordinal ``x`` by ``y``.
|
||||
##
|
||||
## If such a value does not exist, ``OverflowError`` is raised or a compile
|
||||
|
|
|
|||
|
|
@ -20,10 +20,6 @@ const
|
|||
off* = false ## Alias for ``false``.
|
||||
|
||||
type
|
||||
Ordinal*[T] {.magic: Ordinal.} ## Generic ordinal type. Includes integer,
|
||||
## bool, character, and enumeration types
|
||||
## as well as their subtypes.
|
||||
|
||||
SomeSignedInt* = int|int8|int16|int32|int64
|
||||
## Type class matching all signed integer types.
|
||||
|
||||
|
|
@ -35,7 +31,7 @@ type
|
|||
|
||||
SomeOrdinal* = int|int8|int16|int32|int64|bool|enum|uint|uint8|uint16|uint32|uint64
|
||||
## Type class matching all ordinal types; however this includes enums with
|
||||
## holes.
|
||||
## holes. See also `Ordinal`
|
||||
|
||||
BiggestInt* = int64
|
||||
## is an alias for the biggest signed integer type the Nim compiler
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue