doc: bitops: add notes to documentation comments of macros

This commit is contained in:
jiro4989
2020-04-11 08:55:11 +09:00
parent b476905c2a
commit 9e5a07b1ea

View File

@@ -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)