mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-15 05:30:46 +00:00
doc: bitops: add notes to documentation comments of macros
This commit is contained in:
@@ -130,6 +130,9 @@ when defined(nimHasalignOf):
|
||||
|
||||
macro setBits*(v: typed, bits: varargs[typed]): untyped =
|
||||
## Returns ``v``, with the bits at positions ``bits`` set to 1
|
||||
##
|
||||
## **Note:**
|
||||
## * ``v`` must be `var` variable.
|
||||
runnableExamples:
|
||||
var v = 0b0000_0011'u8
|
||||
v.setBits(3, 5, 7)
|
||||
@@ -142,6 +145,9 @@ when defined(nimHasalignOf):
|
||||
|
||||
macro clearBits*(v: typed, bits: varargs[typed]): untyped =
|
||||
## Returns ``v``, with the bits at positions ``bits`` set to 0
|
||||
##
|
||||
## **Note:**
|
||||
## * ``v`` must be `var` variable.
|
||||
runnableExamples:
|
||||
var v = 0b1111_1111'u8
|
||||
v.clearBits(1, 3, 5, 7)
|
||||
@@ -154,6 +160,9 @@ when defined(nimHasalignOf):
|
||||
|
||||
macro flipBits*(v: typed, bits: varargs[typed]): untyped =
|
||||
## Returns ``v``, with the bits at positions ``bits`` set to 0
|
||||
##
|
||||
## **Note:**
|
||||
## * ``v`` must be `var` variable.
|
||||
runnableExamples:
|
||||
var v = 0b0000_1111'u8
|
||||
v.flipBits(1, 3, 5, 7)
|
||||
|
||||
Reference in New Issue
Block a user