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 | |
parent | 4f24facb7ca0e62cb19f4b3c3aceb63f31cf6569 (diff) | |
download | Nim-5439699b9bd539f0b946c3033c887edd449f41b5.tar.gz |
Add type constraints for uint and uint64 to the System module's procs instead
-rw-r--r-- | lib/core/unsigned.nim | 21 | ||||
-rw-r--r-- | lib/system.nim | 10 |
2 files changed, 5 insertions, 26 deletions
diff --git a/lib/core/unsigned.nim b/lib/core/unsigned.nim index c9f7d0d15..a3ddd4125 100644 --- a/lib/core/unsigned.nim +++ b/lib/core/unsigned.nim @@ -57,24 +57,3 @@ proc `<=`*[T: SomeUInt](x, y: T): bool {.magic: "LeU", noSideEffect.} proc `<`*[T: SomeUInt](x, y: T): bool {.magic: "LtU", noSideEffect.} ## Returns true iff ``unsigned(x) < unsigned(y)``. - -proc `+=`*[T: uint|uint64](x: var T, y: T) {.magic: "Inc", noSideEffect.} - ## Increments uints and uint64s, uint8..uint32 are TOrdinals, and already - ## have a definition in the System module. - -proc `-=`*[T: uint|uint64](x: var T, y: T) {.magic: "Dec", noSideEffect.} - ## Decrements uints and uint64s, uint8..uint32 are TOrdinals, and already - ## have a definition in the System module. - -proc `*=`*[T: uint|uint64](x: var T, y: T) {.inline, noSideEffect.} = - ## Binary `*=` operator for uints and uint64s, uint8..uint32 are TOrdinals, - ## and already have a definition in the System module. - x = x * y - -proc inc*[T: uint|uint64](x: var T, y = 1) {.magic: "Inc", noSideEffect.} - ## Increments uints and uint64s ``x`` by ``y``, uint8..uint32 are TOrdinals, - ## and already have a definition in the System module. - -proc dec*[T: uint|uint64](x: var T, y = 1) {.magic: "Dec", noSideEffect.} - ## Decrements uints and uint64s ``x`` by ``y``, uint8..uint32 are TOrdinals, - ## and already have a definition in the System module. 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 |