better documentation for the new shr

This commit is contained in:
narimiran 2019-06-04 12:29:52 +02:00
commit 1f883f6d78
2 changed files with 9 additions and 5 deletions

View file

@ -1291,8 +1291,12 @@ when defined(nimNewShiftOps):
## ##
## .. code-block:: Nim ## .. code-block:: Nim
## 0b0001_0000'i8 shr 2 == 0b0000_0100'i8 ## 0b0001_0000'i8 shr 2 == 0b0000_0100'i8
## 0b1000_0000'i8 shr 8 == 0b0000_0000'i8
## 0b0000_0001'i8 shr 1 == 0b0000_0000'i8 ## 0b0000_0001'i8 shr 1 == 0b0000_0000'i8
## 0b1000_0000'i8 shr 4 == 0b1111_1000'i8
## -1 shr 5 == -1
## 1 shr 5 == 0
## 16 shr 2 == 4
## -16 shr 2 == -4
proc `shr`*(x: int8, y: SomeInteger): int8 {.magic: "AshrI", noSideEffect.} proc `shr`*(x: int8, y: SomeInteger): int8 {.magic: "AshrI", noSideEffect.}
proc `shr`*(x: int16, y: SomeInteger): int16 {.magic: "AshrI", noSideEffect.} proc `shr`*(x: int16, y: SomeInteger): int16 {.magic: "AshrI", noSideEffect.}
proc `shr`*(x: int32, y: SomeInteger): int32 {.magic: "AshrI", noSideEffect.} proc `shr`*(x: int32, y: SomeInteger): int32 {.magic: "AshrI", noSideEffect.}
@ -3387,8 +3391,8 @@ else:
when not defined(JS): when not defined(JS):
proc likelyProc(val: bool): bool {.importc: "NIM_LIKELY", nodecl, nosideeffect.} proc likelyProc(val: bool): bool {.importc: "likely", nodecl, nosideeffect.}
proc unlikelyProc(val: bool): bool {.importc: "NIM_UNLIKELY", nodecl, nosideeffect.} proc unlikelyProc(val: bool): bool {.importc: "unlikely", nodecl, nosideeffect.}
template likely*(val: bool): bool = template likely*(val: bool): bool =
## Hints the optimizer that `val` is likely going to be true. ## Hints the optimizer that `val` is likely going to be true.

View file

@ -36,7 +36,7 @@ pkg "iterutils"
pkg "jstin" pkg "jstin"
pkg "karax", "nim c -r tests/tester.nim" pkg "karax", "nim c -r tests/tester.nim"
pkg "loopfusion" pkg "loopfusion"
# pkg "msgpack4nim" pkg "msgpack4nim"
pkg "nake", "nim c nakefile.nim" pkg "nake", "nim c nakefile.nim"
pkg "neo", "nim c -d:blas=openblas tests/all.nim", true pkg "neo", "nim c -d:blas=openblas tests/all.nim", true
# pkg "nico", "", true # pkg "nico", "", true
@ -52,7 +52,7 @@ pkg "nimgen", "nim c -o:nimgenn -r src/nimgen/runcfg.nim", true
# pkg "nimly", "nim c -r tests/test_nimly", true # pkg "nimly", "nim c -r tests/test_nimly", true
# pkg "nimongo", "nimble test_ci", true # pkg "nimongo", "nimble test_ci", true
pkg "nimpy", "nim c -r tests/nimfrompy.nim" pkg "nimpy", "nim c -r tests/nimfrompy.nim"
# pkg "nimquery" pkg "nimquery"
pkg "nimsl", "", true pkg "nimsl", "", true
pkg "nimsvg" pkg "nimsvg"
pkg "nimx", "nim c --threads:on test/main.nim", true pkg "nimx", "nim c --threads:on test/main.nim", true