Left shift
Left Shift is an operation in computer science and digital electronics, used to shift the bits of binary representation to the left, effectively multiplying the number by two for each shift. It is a fundamental operation in binary arithmetic and computer programming.
Overview[edit | edit source]
The Left Shift operation, often denoted as << in many programming languages, takes two arguments: the value to be shifted, and the number of positions to shift. The operation discards the excess bits that are shifted off and replaces the vacated bit positions on the right with zeros.
Mathematical Interpretation[edit | edit source]
In mathematical terms, a left shift by n positions on a binary number is equivalent to multiplying it by 2^n. This is because binary numbers are base 2, and shifting to the left is analogous to multiplying by the base in decimal numbers.
Use in Programming[edit | edit source]
In computer programming, left shift is used in a variety of contexts. It is often used for efficient multiplication or division by powers of two. It can also be used for extracting specific bits from a binary number, or for creating masks in bit manipulation operations.
Use in Digital Electronics[edit | edit source]
In digital electronics, left shift is used in shift registers, which are a type of sequential logic circuit, primarily for data storage and movement. Shift registers are a fundamental component of digital systems and are used in applications such as data conversion, serial-to-parallel conversion, and delay lines.
See Also[edit | edit source]
Search WikiMD
Ad.Tired of being Overweight? Try W8MD's physician weight loss program.
Semaglutide (Ozempic / Wegovy and Tirzepatide (Mounjaro / Zepbound) available.
Advertise on WikiMD
WikiMD's Wellness Encyclopedia |
Let Food Be Thy Medicine Medicine Thy Food - Hippocrates |
Translate this page: - East Asian
中文,
日本,
한국어,
South Asian
हिन्दी,
தமிழ்,
తెలుగు,
Urdu,
ಕನ್ನಡ,
Southeast Asian
Indonesian,
Vietnamese,
Thai,
မြန်မာဘာသာ,
বাংলা
European
español,
Deutsch,
français,
Greek,
português do Brasil,
polski,
română,
русский,
Nederlands,
norsk,
svenska,
suomi,
Italian
Middle Eastern & African
عربى,
Turkish,
Persian,
Hebrew,
Afrikaans,
isiZulu,
Kiswahili,
Other
Bulgarian,
Hungarian,
Czech,
Swedish,
മലയാളം,
मराठी,
ਪੰਜਾਬੀ,
ગુજરાતી,
Portuguese,
Ukrainian
WikiMD is not a substitute for professional medical advice. See full disclaimer.
Credits:Most images are courtesy of Wikimedia commons, and templates Wikipedia, licensed under CC BY SA or similar.
Contributors: Prab R. Tumpati, MD