mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-06 04:57:49 +00:00
@@ -868,12 +868,13 @@ proc `shr` *(x, y: int8): int8 {.magic: "ShrI", noSideEffect.}
|
||||
proc `shr` *(x, y: int16): int16 {.magic: "ShrI", noSideEffect.}
|
||||
proc `shr` *(x, y: int32): int32 {.magic: "ShrI", noSideEffect.}
|
||||
proc `shr` *(x, y: int64): int64 {.magic: "ShrI", noSideEffect.}
|
||||
## computes the `shift right` operation of `x` and `y`.
|
||||
## computes the `shift right` operation of `x` and `y`, filling
|
||||
## vacant bit positions with zeros.
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## 0b0001_0000'i8 shr 2 == 0b0100_0000'i8
|
||||
## 0b1000_0000'i8 shr 2 == 0b0000_0000'i8
|
||||
## 0b0000_0001'i8 shr 9 == 0b0000_0000'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
|
||||
|
||||
proc `shl` *(x, y: int): int {.magic: "ShlI", noSideEffect.}
|
||||
proc `shl` *(x, y: int8): int8 {.magic: "ShlI", noSideEffect.}
|
||||
|
||||
Reference in New Issue
Block a user