BitShiftLeft

BitShiftLeft[n,k]

shifts the binary bits in the integer n to the left by k places, padding with zeros on the right.

BitShiftLeft[n]

shifts one bit to the left.

Details

  • BitShiftLeft[n,k] is equivalent to n2^k.
  • Negative values of k shift to the right.

Examples

open allclose all

Basic Examples  (1)

Shift 3 places to the left:

Scope  (2)

BitShiftLeft works with numbers of any size:

BitShiftLeft automatically threads itself over lists:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_bitshiftleft, organization={Wolfram Research}, title={BitShiftLeft}, year={2007}, url={https://reference.wolfram.com/language/ref/BitShiftLeft.html}, note=[Accessed: 25-November-2024 ]}