BitSet

BitSet[n,k]

sets to 1 the bit corresponding to the coefficient of in the integer n.

Details

  • BitSet[n,k] sets the bit k places from the right.

Examples

open allclose all

Basic Examples  (1)

Display coefficients at powers of 2 in the integer 42:

Set the bit corresponding to the coefficient at 20 to 1:

Set the bit corresponding to the coefficient at 24:

Scope  (1)

BitSet automatically creates an integer of the necessary size:

Wolfram Research (2007), BitSet, Wolfram Language function, https://reference.wolfram.com/language/ref/BitSet.html.

Text

Wolfram Research (2007), BitSet, Wolfram Language function, https://reference.wolfram.com/language/ref/BitSet.html.

BibTeX

@misc{reference.wolfram_2021_bitset, author="Wolfram Research", title="{BitSet}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/BitSet.html}", note=[Accessed: 28-November-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_bitset, organization={Wolfram Research}, title={BitSet}, year={2007}, url={https://reference.wolfram.com/language/ref/BitSet.html}, note=[Accessed: 28-November-2021 ]}

CMS

Wolfram Language. 2007. "BitSet." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/BitSet.html.

APA

Wolfram Language. (2007). BitSet. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BitSet.html