diff options
author | def <dennis@felsin9.de> | 2014-06-28 16:24:14 +0200 |
---|---|---|
committer | def <dennis@felsin9.de> | 2014-06-28 16:24:14 +0200 |
commit | 5439699b9bd539f0b946c3033c887edd449f41b5 (patch) | |
tree | 3a6bf04cf616d53e832f93ecdf437e05c864d8ea /lib/system.nim | |
parent | 4f24facb7ca0e62cb19f4b3c3aceb63f31cf6569 (diff) | |
download | Nim-5439699b9bd539f0b946c3033c887edd449f41b5.tar.gz |
Add type constraints for uint and uint64 to the System module's procs instead
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/system.nim b/lib/system.nim index f45707849..0cd1f77df 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -431,12 +431,12 @@ proc pred*[T](x: Ordinal[T], y = 1): T {.magic: "Pred", noSideEffect.} ## an ordinal type. If such a value does not exist, ``EOutOfRange`` is raised ## or a compile time error occurs. -proc inc*[T](x: var Ordinal[T], y = 1) {.magic: "Inc", noSideEffect.} +proc inc*[T: Ordinal|uint|uint64](x: var T, y = 1) {.magic: "Inc", noSideEffect.} ## increments the ordinal ``x`` by ``y``. If such a value does not ## exist, ``EOutOfRange`` is raised or a compile time error occurs. This is a ## short notation for: ``x = succ(x, y)``. -proc dec*[T](x: var Ordinal[T], y = 1) {.magic: "Dec", noSideEffect.} +proc dec*[T: Ordinal|uint|uint64](x: var T, y = 1) {.magic: "Dec", noSideEffect.} ## decrements the ordinal ``x`` by ``y``. If such a value does not ## exist, ``EOutOfRange`` is raised or a compile time error occurs. This is a ## short notation for: ``x = pred(x, y)``. @@ -2745,13 +2745,13 @@ proc staticExec*(command: string, input = ""): string {. ## inside a pragma like `passC <nimrodc.html#passc-pragma>`_ or `passL ## <nimrodc.html#passl-pragma>`_. -proc `+=`*[T: TOrdinal](x: var T, y: T) {.magic: "Inc", noSideEffect.} +proc `+=`*[T: TOrdinal|uint|uint64](x: var T, y: T) {.magic: "Inc", noSideEffect.} ## Increments an ordinal -proc `-=`*[T: TOrdinal](x: var T, y: T) {.magic: "Dec", noSideEffect.} +proc `-=`*[T: TOrdinal|uint|uint64](x: var T, y: T) {.magic: "Dec", noSideEffect.} ## Decrements an ordinal -proc `*=`*[T: TOrdinal](x: var T, y: T) {.inline, noSideEffect.} = +proc `*=`*[T: TOrdinal|uint|uint64](x: var T, y: T) {.inline, noSideEffect.} = ## Binary `*=` operator for ordinals x = x * y |