diff options
author | Bung <crc32@qq.com> | 2022-12-01 20:34:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-01 13:34:00 +0100 |
commit | 658b28dc5707601b39d9aad4b6bf79a9afff1e92 (patch) | |
tree | b8e10d4d1f2666c45c3b1dec23e7c03d5ba23be9 /lib/system/arithmetics.nim | |
parent | a70d3abd37819e7562f80f0c808788c3f5c62c55 (diff) | |
download | Nim-658b28dc5707601b39d9aad4b6bf79a9afff1e92.tar.gz |
tyInt tyUint fit target int bit width (#20829)
Diffstat (limited to 'lib/system/arithmetics.nim')
-rw-r--r-- | lib/system/arithmetics.nim | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/system/arithmetics.nim b/lib/system/arithmetics.nim index 910e73507..d05aaaa5b 100644 --- a/lib/system/arithmetics.nim +++ b/lib/system/arithmetics.nim @@ -1,4 +1,4 @@ -proc succ*[T: Ordinal](x: T, y = 1): T {.magic: "Succ", noSideEffect.} = +proc succ*[T, V: Ordinal](x: T, y: V = 1): T {.magic: "Succ", noSideEffect.} = ## Returns the `y`-th successor (default: 1) of the value `x`. ## ## If such a value does not exist, `OverflowDefect` is raised @@ -7,7 +7,7 @@ proc succ*[T: Ordinal](x: T, y = 1): T {.magic: "Succ", noSideEffect.} = assert succ(5) == 6 assert succ(5, 3) == 8 -proc pred*[T: Ordinal](x: T, y = 1): T {.magic: "Pred", noSideEffect.} = +proc pred*[T, V: Ordinal](x: T, y: V = 1): T {.magic: "Pred", noSideEffect.} = ## Returns the `y`-th predecessor (default: 1) of the value `x`. ## ## If such a value does not exist, `OverflowDefect` is raised @@ -16,7 +16,7 @@ proc pred*[T: Ordinal](x: T, y = 1): T {.magic: "Pred", noSideEffect.} = assert pred(5) == 4 assert pred(5, 3) == 2 -proc inc*[T: Ordinal](x: var T, y = 1) {.magic: "Inc", noSideEffect.} = +proc inc*[T, V: Ordinal](x: var T, y: V = 1) {.magic: "Inc", noSideEffect.} = ## Increments the ordinal `x` by `y`. ## ## If such a value does not exist, `OverflowDefect` is raised or a compile @@ -28,7 +28,7 @@ proc inc*[T: Ordinal](x: var T, y = 1) {.magic: "Inc", noSideEffect.} = inc(i, 3) assert i == 6 -proc dec*[T: Ordinal](x: var T, y = 1) {.magic: "Dec", noSideEffect.} = +proc dec*[T, V: Ordinal](x: var T, y: V = 1) {.magic: "Dec", noSideEffect.} = ## Decrements the ordinal `x` by `y`. ## ## If such a value does not exist, `OverflowDefect` is raised or a compile |