CINXE.COM

Arithmetic shift - Wikipedia

<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Arithmetic shift - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy", "wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"e584a0b3-9e0e-4d8b-838e-0ab4a4d94b8a","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Arithmetic_shift","wgTitle":"Arithmetic shift","wgCurRevisionId":1221514546,"wgRevisionId":1221514546,"wgArticleId":40725,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Wikipedia articles needing page number citations from March 2012","Articles with short description","Short description matches Wikidata","All articles with unsourced statements","Articles with unsourced statements from August 2023","Wikipedia articles incorporating text from the Federal Standard 1037C","CS1 errors: periodical ignored","Binary arithmetic","Operators (programming)"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext", "wgRelevantPageName":"Arithmetic_shift","wgRelevantArticleId":40725,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":20000,"wgRelatedArticlesCompat":[],"wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false,"wgWikibaseItemId":"Q4791137","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness", "fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":false,"wgGELevelingUpEnabledForUser":false};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["ext.cite.ux-enhancements","mediawiki.page.media","ext.scribunto.logs","site","mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher", "ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.growthExperiments.SuggestedEditSession","wikibase.sidebar.tracking"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=ext.cite.styles%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediaBadges%7Cext.wikimediamessages.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&amp;only=styles&amp;skin=vector-2022"> <script async="" src="/w/load.php?lang=en&amp;modules=startup&amp;only=scripts&amp;raw=1&amp;skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&amp;modules=site.styles&amp;only=styles&amp;skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.4"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/3/37/Rotate_right_arithmetically.svg/1200px-Rotate_right_arithmetically.svg.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="960"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/3/37/Rotate_right_arithmetically.svg/800px-Rotate_right_arithmetically.svg.png"> <meta property="og:image:width" content="800"> <meta property="og:image:height" content="640"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/3/37/Rotate_right_arithmetically.svg/640px-Rotate_right_arithmetically.svg.png"> <meta property="og:image:width" content="640"> <meta property="og:image:height" content="512"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Arithmetic shift - Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/Arithmetic_shift"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=Arithmetic_shift&amp;action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/Arithmetic_shift"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&amp;feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Arithmetic_shift rootpage-Arithmetic_shift skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page&#039;s font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=C13_en.wikipedia.org&amp;uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&amp;returnto=Arithmetic+shift" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&amp;returnto=Arithmetic+shift" title="You&#039;re encouraged to log in; however, it&#039;s not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&amp;utm_medium=sidebar&amp;utm_campaign=C13_en.wikipedia.org&amp;uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&amp;returnto=Arithmetic+shift" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&amp;returnto=Arithmetic+shift" title="You&#039;re encouraged to log in; however, it&#039;s not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-Formal_definition" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Formal_definition"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Formal definition</span> </div> </a> <button aria-controls="toc-Formal_definition-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Formal definition subsection</span> </button> <ul id="toc-Formal_definition-sublist" class="vector-toc-list"> <li id="toc-Equivalence_of_arithmetic_and_logical_left_shifts_and_multiplication" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Equivalence_of_arithmetic_and_logical_left_shifts_and_multiplication"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>Equivalence of arithmetic and logical left shifts and multiplication</span> </div> </a> <ul id="toc-Equivalence_of_arithmetic_and_logical_left_shifts_and_multiplication-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Non-equivalence_of_arithmetic_right_shift_and_division" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Non-equivalence_of_arithmetic_right_shift_and_division"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2</span> <span>Non-equivalence of arithmetic right shift and division</span> </div> </a> <ul id="toc-Non-equivalence_of_arithmetic_right_shift_and_division-sublist" class="vector-toc-list"> <li id="toc-Handling_the_issue_in_programming_languages" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Handling_the_issue_in_programming_languages"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.2.1</span> <span>Handling the issue in programming languages</span> </div> </a> <ul id="toc-Handling_the_issue_in_programming_languages-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> </ul> </li> <li id="toc-Applications" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Applications"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Applications</span> </div> </a> <ul id="toc-Applications-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notes" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Notes"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Notes</span> </div> </a> <ul id="toc-Notes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>References</span> </div> </a> <button aria-controls="toc-References-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle References subsection</span> </button> <ul id="toc-References-sublist" class="vector-toc-list"> <li id="toc-Cross-reference" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Cross-reference"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.1</span> <span>Cross-reference</span> </div> </a> <ul id="toc-Cross-reference-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Sources_used" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Sources_used"> <div class="vector-toc-text"> <span class="vector-toc-numb">4.2</span> <span>Sources used</span> </div> </a> <ul id="toc-Sources_used-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Arithmetic shift</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 4 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-4" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">4 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EC%82%B0%EC%88%A0_%EC%8B%9C%ED%94%84%ED%8A%B8" title="산술 시프트 – Korean" lang="ko" hreflang="ko" data-title="산술 시프트" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Deslocamento_aritm%C3%A9tico" title="Deslocamento aritmético – Portuguese" lang="pt" hreflang="pt" data-title="Deslocamento aritmético" data-language-autonym="Português" data-language-local-name="Portuguese" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ro mw-list-item"><a href="https://ro.wikipedia.org/wiki/Deplasare_aritmetic%C4%83" title="Deplasare aritmetică – Romanian" lang="ro" hreflang="ro" data-title="Deplasare aritmetică" data-language-autonym="Română" data-language-local-name="Romanian" class="interlanguage-link-target"><span>Română</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E7%AE%97%E6%9C%AF%E7%A7%BB%E4%BD%8D" title="算术移位 – Chinese" lang="zh" hreflang="zh" data-title="算术移位" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q4791137#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Arithmetic_shift" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Arithmetic_shift" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Arithmetic_shift"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Arithmetic_shift&amp;action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Arithmetic_shift"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Arithmetic_shift&amp;action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Arithmetic_shift" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Arithmetic_shift" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Arithmetic_shift&amp;oldid=1221514546" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Arithmetic_shift&amp;action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&amp;page=Arithmetic_shift&amp;id=1221514546&amp;wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FArithmetic_shift"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FArithmetic_shift"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&amp;page=Arithmetic_shift&amp;action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Arithmetic_shift&amp;printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q4791137" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">Shift operator in computer programming</div> <figure typeof="mw:File/Thumb"><a href="/wiki/File:Rotate_right_arithmetically.svg" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/3/37/Rotate_right_arithmetically.svg/300px-Rotate_right_arithmetically.svg.png" decoding="async" width="300" height="240" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/3/37/Rotate_right_arithmetically.svg/450px-Rotate_right_arithmetically.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/3/37/Rotate_right_arithmetically.svg/600px-Rotate_right_arithmetically.svg.png 2x" data-file-width="175" data-file-height="140" /></a><figcaption>A right arithmetic shift of a binary number by 1. The empty position in the most significant bit is filled with a copy of the original MSB.</figcaption></figure> <figure typeof="mw:File/Thumb"><a href="/wiki/File:Rotate_left_logically.svg" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Rotate_left_logically.svg/300px-Rotate_left_logically.svg.png" decoding="async" width="300" height="200" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Rotate_left_logically.svg/450px-Rotate_left_logically.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/5/5c/Rotate_left_logically.svg/600px-Rotate_left_logically.svg.png 2x" data-file-width="210" data-file-height="140" /></a><figcaption>A left arithmetic shift of a binary number by 1. The empty position in the <a href="/wiki/Least_significant_bit" class="mw-redirect" title="Least significant bit">least significant bit</a> is filled with a zero.</figcaption></figure> <table class="wikitable" style="float:right; clear:right;"> <caption>Arithmetic shift operators in various programming languages and processors </caption> <tbody><tr> <th>Language or processor</th> <th>Left</th> <th>Right </th></tr> <tr> <td style="max-width:195px"><a href="/wiki/ActionScript" title="ActionScript">ActionScript</a> 3, <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a>, <a href="/wiki/JavaScript" title="JavaScript">JavaScript</a>, <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a>, <a href="/wiki/PHP" title="PHP">PHP</a>, <a href="/wiki/Ruby_(programming_language)" title="Ruby (programming language)">Ruby</a>, <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a>, <a href="/wiki/C%2B%2B" title="C++">C++</a>,<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">&#91;</span>1<span class="cite-bracket">&#93;</span></a></sup><a href="/wiki/D_(programming_language)" title="D (programming language)">D</a>, <a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a>, <a href="/wiki/Go_(programming_language)" title="Go (programming language)">Go</a>, <a href="/wiki/Julia_(programming_language)" title="Julia (programming language)">Julia</a>,<br /><a href="/wiki/Rust_(programming_language)" title="Rust (programming language)">Rust</a> (signed types only)<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">&#91;</span>2<span class="cite-bracket">&#93;</span></a></sup>,<br /><a href="/wiki/Swift_(programming_language)" title="Swift (programming language)">Swift</a> (signed types only)<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">&#91;</span>note 1<span class="cite-bracket">&#93;</span></a></sup></td> <td><code> &lt;&lt; </code></td> <td><code> &gt;&gt; </code> </td></tr> <tr> <td><a href="/wiki/Ada_(programming_language)" title="Ada (programming language)">Ada</a></td> <td><code> Shift_Left </code><sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">&#91;</span>3<span class="cite-bracket">&#93;</span></a></sup></td> <td><code> Shift_Right_Arithmetic </code> </td></tr> <tr> <td><a href="/wiki/Kotlin_(programming_language)" title="Kotlin (programming language)">Kotlin</a></td> <td><code> shl </code></td> <td><code> shr </code> </td></tr> <tr> <td><a href="/wiki/Fortran" title="Fortran">Fortran</a></td> <td><code> SHIFTL </code></td> <td><code> SHIFTA </code><sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">&#91;</span>note 2<span class="cite-bracket">&#93;</span></a></sup> </td></tr> <tr> <td><a href="/wiki/Standard_ML" title="Standard ML">Standard ML</a></td> <td><code> &lt;&lt; </code></td> <td><code> ~&gt;&gt; </code> </td></tr> <tr> <td><a href="/wiki/Verilog" title="Verilog">Verilog</a></td> <td><code> &lt;&lt;&lt; </code></td> <td><code> &gt;&gt;&gt; </code><sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">&#91;</span>note 3<span class="cite-bracket">&#93;</span></a></sup> </td></tr> <tr> <td><a href="/wiki/OpenVMS" title="OpenVMS">OpenVMS</a> macro language </td> <td colspan="2" align="center">@<sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">&#91;</span>note 4<span class="cite-bracket">&#93;</span></a></sup> </td></tr> <tr> <td><a href="/wiki/Scheme_(programming_language)" title="Scheme (programming language)">Scheme</a> </td> <td colspan="2" align="center"><code>arithmetic-shift</code><sup id="cite_ref-scheme_9-0" class="reference"><a href="#cite_note-scheme-9"><span class="cite-bracket">&#91;</span>note 5<span class="cite-bracket">&#93;</span></a></sup> </td></tr> <tr> <td><a href="/wiki/Common_Lisp" title="Common Lisp">Common Lisp</a> </td> <td colspan="2" align="center"><code>ash</code> </td></tr> <tr> <td><a href="/wiki/OCaml" title="OCaml">OCaml</a></td> <td><code>lsl</code></td> <td><code>asr</code> </td></tr> <tr> <td><a href="/wiki/Haskell_(programming_language)" class="mw-redirect" title="Haskell (programming language)">Haskell</a> </td> <td colspan="2" align="center"><code>Data.Bits.shift</code><sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">&#91;</span>note 6<span class="cite-bracket">&#93;</span></a></sup> </td></tr> <tr> <td><a href="/wiki/VHDL" title="VHDL">VHDL</a></td> <td><code>sla</code><sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">&#91;</span>note 7<span class="cite-bracket">&#93;</span></a></sup></td> <td><code>sra</code> </td></tr> <tr> <td>Assembly: <a href="/wiki/Z80" class="mw-redirect" title="Z80">Z80</a></td> <td><code>SLA</code><sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span class="cite-bracket">&#91;</span>5<span class="cite-bracket">&#93;</span></a></sup></td> <td><code>SRA</code> </td></tr> <tr> <td>Assembly: <a href="/wiki/X86_assembly_language" title="X86 assembly language">x86</a></td> <td><code>SAL</code></td> <td><code>SAR</code> </td></tr> <tr> <td>Assembly: <a href="/wiki/Motorola_68000_series" title="Motorola 68000 series">68k</a></td> <td><code>ASL</code></td> <td><code>ASR</code> </td></tr> <tr> <td>Assembly: <a href="/wiki/RISC-V" title="RISC-V">RISC-V</a></td> <td><code>sll</code>, <code>slli</code><sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">&#91;</span>6<span class="cite-bracket">&#93;</span></a></sup></td> <td><code>sra</code>, <code>srai</code> </td></tr></tbody></table> <p>In <a href="/wiki/Computer_programming" title="Computer programming">computer programming</a>, an <b>arithmetic shift</b> is a <a href="/wiki/Bitwise_operation#Bit_shifts" title="Bitwise operation">shift operator</a>, sometimes termed a <b>signed shift</b> (though it is not restricted to signed operands). The two basic types are the <b>arithmetic left shift</b> and the <b>arithmetic right shift</b>. For <a href="/wiki/Binary_numeral_system" class="mw-redirect" title="Binary numeral system">binary numbers</a> it is a <a href="/wiki/Bitwise_operation" title="Bitwise operation">bitwise operation</a> that shifts all of the bits of its operand; every bit in the operand is simply moved a given number of bit positions, and the vacant bit-positions are filled in. Instead of being filled with all 0s, as in <a href="/wiki/Logical_shift" title="Logical shift">logical shift</a>, when shifting to the right, the leftmost bit (usually the <a href="/wiki/Sign_bit" title="Sign bit">sign bit</a> in signed integer representations) is replicated to fill in all the vacant positions (this is a kind of <a href="/wiki/Sign_extension" title="Sign extension">sign extension</a>). </p><p>Some authors prefer the terms <i>sticky right-shift</i> and <i>zero-fill right-shift</i> for arithmetic and logical shifts respectively.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">&#91;</span>7<span class="cite-bracket">&#93;</span></a></sup> </p><p>Arithmetic shifts can be useful as efficient ways to perform multiplication or division of signed integers by powers of two. Shifting left by <i>n</i> bits on a signed or unsigned binary number has the effect of multiplying it by 2<sup><i>n</i></sup>. Shifting right by <i>n</i> bits on a <a href="/wiki/Two%27s_complement" title="Two&#39;s complement">two's complement</a> <i>signed</i> binary number has the effect of dividing it by 2<sup><i>n</i></sup>, but it always rounds down (towards negative infinity). This is different from the way rounding is usually done in signed integer division (which rounds towards 0). This discrepancy has led to bugs in a number of compilers.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">&#91;</span>8<span class="cite-bracket">&#93;</span></a></sup> </p><p>For example, in the <a href="/wiki/X86_instruction_listings" title="X86 instruction listings">x86 instruction set</a>, the SAR instruction (arithmetic right shift) divides a signed number by a power of two, rounding towards negative infinity.<sup id="cite_ref-FOOTNOTEHyde1996§_6.6.2.2_SAR_16-0" class="reference"><a href="#cite_note-FOOTNOTEHyde1996§_6.6.2.2_SAR-16"><span class="cite-bracket">&#91;</span>9<span class="cite-bracket">&#93;</span></a></sup> However, the IDIV instruction (signed divide) divides a signed number, rounding towards zero. So a SAR instruction cannot be substituted for an IDIV by power of two instruction nor vice versa. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Formal_definition">Formal definition</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit&amp;section=1" title="Edit section: Formal definition"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The formal definition of an arithmetic shift, from <a href="/wiki/Federal_Standard_1037C" title="Federal Standard 1037C">Federal Standard 1037C</a> is that it is: </p> <dl><dd>A shift, applied to the representation of a number in a fixed <a href="/wiki/Radix" title="Radix">radix</a> numeration system and in a <a href="/wiki/Fixed-point_arithmetic" title="Fixed-point arithmetic">fixed-point</a> representation system, and in which only the characters representing the fixed-point part of the number are moved. An arithmetic shift is usually equivalent to multiplying the number by a positive or a negative integral power of the radix, except for the effect of any rounding; compare the <a href="/wiki/Logical_shift" title="Logical shift">logical shift</a> with the arithmetic shift, especially in the case of <a href="/wiki/Floating-point" class="mw-redirect" title="Floating-point">floating-point</a> representation.</dd></dl> <p>An important word in the FS 1073C definition is "usually". </p> <div class="mw-heading mw-heading3"><h3 id="Equivalence_of_arithmetic_and_logical_left_shifts_and_multiplication">Equivalence of arithmetic and logical left shifts and multiplication</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit&amp;section=2" title="Edit section: Equivalence of arithmetic and logical left shifts and multiplication"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Arithmetic <i>left</i> shifts are equivalent to multiplication by a (positive, integral) power of the radix (e.g., a multiplication by a power of 2 for binary numbers). Logical left shifts are also equivalent, except multiplication and arithmetic shifts may trigger <a href="/wiki/Arithmetic_overflow" class="mw-redirect" title="Arithmetic overflow">arithmetic overflow</a> whereas logical shifts do not <sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (August 2023)">citation needed</span></a></i>&#93;</sup>. </p> <div class="mw-heading mw-heading3"><h3 id="Non-equivalence_of_arithmetic_right_shift_and_division">Non-equivalence of arithmetic right shift and division</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit&amp;section=3" title="Edit section: Non-equivalence of arithmetic right shift and division"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>However, arithmetic <i>right</i> shifts are major traps for the unwary, specifically in treating rounding of negative integers. For example, in the usual <a href="/wiki/Two%27s_complement" title="Two&#39;s complement">two's complement</a> representation of negative integers, −1 is represented as all 1's. For an 8-bit signed integer this is 1111&#160;1111. An arithmetic right-shift by 1 (or 2, 3, ..., 7) yields 1111&#160;1111 again, which is still −1. This corresponds to rounding down (towards negative infinity), but is not the usual convention for division. </p><p>It is frequently stated that arithmetic right shifts are equivalent to <a href="/wiki/Division_(mathematics)" title="Division (mathematics)">division</a> by a (positive, integral) power of the radix (e.g., a division by a power of 2 for binary numbers), and hence that division by a power of the radix can be optimized by implementing it as an arithmetic right shift. (A shifter is much simpler than a divider. On most processors, shift instructions will execute faster than division instructions.) Large number of 1960s and 1970s programming handbooks, manuals, and other specifications from companies and institutions such as <a href="/wiki/Digital_Equipment_Corporation" title="Digital Equipment Corporation">DEC</a>, <a href="/wiki/IBM" title="IBM">IBM</a>, <a href="/wiki/Data_General" title="Data General">Data General</a>, and <a href="/wiki/American_National_Standards_Institute" title="American National Standards Institute">ANSI</a> make such incorrect statements<sup id="cite_ref-FOOTNOTESteele1977_17-0" class="reference"><a href="#cite_note-FOOTNOTESteele1977-17"><span class="cite-bracket">&#91;</span>10<span class="cite-bracket">&#93;</span></a></sup><sup class="noprint Inline-Template" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citing_sources" title="Wikipedia:Citing sources"><span title="This citation requires a reference to the specific page or range of pages in which the material appears. (March 2012)">page&#160;needed</span></a></i>&#93;</sup>. </p><p>Logical right shifts are equivalent to division by a power of the radix (usually 2) only for positive or unsigned numbers. Arithmetic right shifts are equivalent to logical right shifts for positive signed numbers. Arithmetic right shifts for negative numbers in N's complement (usually <a href="/wiki/Two%27s_complement" title="Two&#39;s complement">two's complement</a>) is roughly equivalent to division by a power of the radix (usually 2), where for odd numbers rounding downwards is applied (not towards 0 as usually expected). </p><p>Arithmetic right shifts for negative numbers are equivalent to division using rounding towards 0 in <a href="/wiki/Ones%27_complement" title="Ones&#39; complement">ones' complement</a> representation of signed numbers as was used by some historic computers, but this is no longer in general use. </p> <div class="mw-heading mw-heading4"><h4 id="Handling_the_issue_in_programming_languages">Handling the issue in programming languages</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit&amp;section=4" title="Edit section: Handling the issue in programming languages"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The (1999) ISO standard for the programming language <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a> defines the right shift operator in terms of divisions by powers of 2.<sup id="cite_ref-FOOTNOTEISOIEC98991999§_6.5.7_Bitwise_shift_operators_18-0" class="reference"><a href="#cite_note-FOOTNOTEISOIEC98991999§_6.5.7_Bitwise_shift_operators-18"><span class="cite-bracket">&#91;</span>11<span class="cite-bracket">&#93;</span></a></sup> Because of the above-stated non-equivalence, the standard explicitly excludes from that definition the right shifts of signed numbers that have negative values. It does not specify the behaviour of the right shift operator in such circumstances, but instead requires each individual C compiler to define the behaviour of shifting negative values right.<sup id="cite_ref-20" class="reference"><a href="#cite_note-20"><span class="cite-bracket">&#91;</span>note 8<span class="cite-bracket">&#93;</span></a></sup> </p><p>Like C, C++ had an implementation-defined right shift for signed integers until C++20. Starting in the C++20 standard, right shift of a signed integer is defined to be an arithmetic shift.<sup id="cite_ref-FOOTNOTEISOCPP202020§_7.6.7_Shift_operators_21-0" class="reference"><a href="#cite_note-FOOTNOTEISOCPP202020§_7.6.7_Shift_operators-21"><span class="cite-bracket">&#91;</span>13<span class="cite-bracket">&#93;</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="Applications">Applications</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit&amp;section=5" title="Edit section: Applications"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>In applications where consistent rounding down is desired, arithmetic right shifts for signed values are useful. An example is in <a href="/wiki/Downscaling" title="Downscaling">downscaling</a> raster coordinates by a power of two, which maintains even spacing. For example, right shift by 1 sends 0, 1, 2, 3, 4, 5, ... to 0, 0, 1, 1, 2, 2, ..., and −1, −2, −3, −4, ... to −1, −1, −2, −2, ..., maintaining even spacing as −2, −2, −1, −1, 0, 0, 1, 1, 2, 2, ... In contrast, integer division with rounding towards zero sends −1, 0, and 1 all to 0 (3 points instead of 2), yielding −2, −1, −1, 0, 0, 0, 1, 1, 2, 2, ... instead, which is irregular at 0. </p> <div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit&amp;section=6" title="Edit section: Notes"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-references-wrap"><ol class="references"> <li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text">The <code> &gt;&gt; </code> operator in C and C++ is not necessarily an arithmetic shift. Usually it is only an arithmetic shift if used with a signed integer type on its left-hand side. If it is used on an unsigned integer type instead, it will be a <i>logical</i> shift.</span> </li> <li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text">Fortran 2008.</span> </li> <li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text">The Verilog arithmetic right shift operator only actually performs an arithmetic shift if the first operand is signed. If the first operand is unsigned, the operator actually performs a <i>logical</i> right shift.</span> </li> <li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text">In the <a href="/wiki/OpenVMS" title="OpenVMS">OpenVMS</a> macro language, whether an arithmetic shift is left or right is determined by whether the second operand is positive or negative. This is unusual. In most programming languages the two directions have distinct operators, with the operator specifying the direction, and the second operand is implicitly positive. (Some languages, such as Verilog, require that negative values be converted to unsigned positive values. Some languages, such as C and C++, have no defined behaviour if negative values are used.)<sup id="cite_ref-FOOTNOTEHP2001_7-0" class="reference"><a href="#cite_note-FOOTNOTEHP2001-7"><span class="cite-bracket">&#91;</span>4<span class="cite-bracket">&#93;</span></a></sup><sup class="noprint Inline-Template" style="white-space:nowrap;">&#91;<i><a href="/wiki/Wikipedia:Citing_sources" title="Wikipedia:Citing sources"><span title="This citation requires a reference to the specific page or range of pages in which the material appears. (March 2012)">page&#160;needed</span></a></i>&#93;</sup></span> </li> <li id="cite_note-scheme-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-scheme_9-0">^</a></b></span> <span class="reference-text">In Scheme <code>arithmetic-shift</code> can be both left and right shift, depending on the second operand, very similar to the OpenVMS macro language, although R6RS Scheme adds both <code>-right</code> and <code>-left</code> variants.</span> </li> <li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text">The <code>Bits</code> class from Haskell's <code>Data.Bits</code> module defines both <code>shift</code> taking a signed argument and <code>shiftL</code>/<code>shiftR</code> taking unsigned arguments. These are <a href="/wiki/Isomorphic" class="mw-redirect" title="Isomorphic">isomorphic</a>; for new definitions the programmer need provide only one of the two forms and the other form will be automatically defined in terms of the provided one.</span> </li> <li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text">The VHDL arithmetic left shift operator is unusual. Instead of filling the LSB of the result with zero, it copies the original LSB into the new LSB. While this is an exact mirror image of the arithmetic right shift, it is not the conventional definition of the operator, and is not equivalent to multiplication by a power of 2. In the VHDL 2008 standard this strange behavior was left unchanged (for backward compatibility) for argument types that do not have forced numeric interpretation (e.g., BIT_VECTOR) but 'SLA' for <i>unsigned</i> and <i>signed</i> argument types behaves in the expected way (i.e., rightmost positions are filled with zeros). VHDL's shift left logical (SLL) function does implement the aforementioned 'standard' arithmetic shift.</span> </li> <li id="cite_note-20"><span class="mw-cite-backlink"><b><a href="#cite_ref-20">^</a></b></span> <span class="reference-text">The C standard was intended to not restrict the C language to either ones' complement or two's complement architectures. In cases where the behaviours of ones' complement and two's complement representations differ, such as this, the standard requires individual C compilers to document the behaviour of their target architectures. The documentation for <a href="/wiki/GNU_Compiler_Collection" title="GNU Compiler Collection">GNU Compiler Collection</a> (GCC), for example, documents its behaviour as employing sign-extension.<sup id="cite_ref-FOOTNOTEFSF2008§_4.5_Integers_implementation_19-0" class="reference"><a href="#cite_note-FOOTNOTEFSF2008§_4.5_Integers_implementation-19"><span class="cite-bracket">&#91;</span>12<span class="cite-bracket">&#93;</span></a></sup></span> </li> </ol></div> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit&amp;section=7" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <div class="mw-heading mw-heading3"><h3 id="Cross-reference">Cross-reference</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit&amp;section=8" title="Edit section: Cross-reference"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="reflist reflist-columns references-column-width" style="column-width: 30em;"> <ol class="references"> <li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://tour.dlang.org/tour/en/gems/bit-manipulation">"Bit manipulation - Dlang Tour"</a>. <i>tour.dlang.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2019-06-23</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=tour.dlang.org&amp;rft.atitle=Bit+manipulation+-+Dlang+Tour&amp;rft_id=https%3A%2F%2Ftour.dlang.org%2Ftour%2Fen%2Fgems%2Fbit-manipulation&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></span> </li> <li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://doc.rust-lang.org/reference/expressions/operator-expr.html#arithmetic-and-logical-binary-operators">"Operator Expressions: Arithmetic and Logical Binary Operators"</a>. <i>doc.rust-lang.org</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2022-11-13</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=doc.rust-lang.org&amp;rft.atitle=Operator+Expressions%3A+Arithmetic+and+Logical+Binary+Operators&amp;rft_id=https%3A%2F%2Fdoc.rust-lang.org%2Freference%2Fexpressions%2Foperator-expr.html%23arithmetic-and-logical-binary-operators&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></span> </li> <li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.adaic.org/resources/add_content/standards/12aarm/html/AA-B-2.html">"Annotated Ada 2012 Reference Manual"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Annotated+Ada+2012+Reference+Manual&amp;rft_id=https%3A%2F%2Fwww.adaic.org%2Fresources%2Fadd_content%2Fstandards%2F12aarm%2Fhtml%2FAA-B-2.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></span> </li> <li id="cite_note-FOOTNOTEHP2001-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTEHP2001_7-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFHP2001">HP 2001</a>.</span> </li> <li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.z80.info/z80syntx.htm#SLA">"Z80 Assembler Syntax"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Z80+Assembler+Syntax&amp;rft_id=http%3A%2F%2Fwww.z80.info%2Fz80syntx.htm%23SLA&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></span> </li> <li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://github.com/riscv/riscv-isa-manual/releases/download/Ratified-IMAFDQC/riscv-spec-20191213.pdf">"The RISC-V Instruction Set Manual, Volume I: Unprivileged ISA"</a> <span class="cs1-format">(PDF)</span>. <i><a href="/wiki/GitHub" title="GitHub">GitHub</a></i>. 2019-12-13. pp.&#160;18–20. <a rel="nofollow" class="external text" href="https://ghostarchive.org/archive/20221009/https://github.com/riscv/riscv-isa-manual/releases/download/Ratified-IMAFDQC/riscv-spec-20191213.pdf">Archived</a> <span class="cs1-format">(PDF)</span> from the original on 2022-10-09<span class="reference-accessdate">. Retrieved <span class="nowrap">2021-08-07</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=GitHub&amp;rft.atitle=The+RISC-V+Instruction+Set+Manual%2C+Volume+I%3A+Unprivileged+ISA&amp;rft.pages=18-20&amp;rft.date=2019-12-13&amp;rft_id=https%3A%2F%2Fgithub.com%2Friscv%2Friscv-isa-manual%2Freleases%2Fdownload%2FRatified-IMAFDQC%2Friscv-spec-20191213.pdf&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></span> </li> <li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"> Thomas R. Cain and Alan T. Sherman. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20140109191811/http://www.cisa.umbc.edu/papers/ShermanCryptologia97.pdf">"How to break Gifford's cipher"</a>. Section 8.1: "Sticky versus Non-Sticky Bit-shifting". Cryptologia. 1997.</span> </li> <li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFSteele_Jr" class="citation web cs1">Steele Jr, Guy. <a rel="nofollow" class="external text" href="http://dspace.mit.edu/bitstream/handle/1721.1/6090/AIM-378.pdf">"Arithmetic Shifting Considered Harmful"</a> <span class="cs1-format">(PDF)</span>. MIT AI Lab. <a rel="nofollow" class="external text" href="https://ghostarchive.org/archive/20221009/http://dspace.mit.edu/bitstream/handle/1721.1/6090/AIM-378.pdf">Archived</a> <span class="cs1-format">(PDF)</span> from the original on 2022-10-09<span class="reference-accessdate">. Retrieved <span class="nowrap">20 May</span> 2013</span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Arithmetic+Shifting+Considered+Harmful&amp;rft.pub=MIT+AI+Lab&amp;rft.aulast=Steele+Jr&amp;rft.aufirst=Guy&amp;rft_id=http%3A%2F%2Fdspace.mit.edu%2Fbitstream%2Fhandle%2F1721.1%2F6090%2FAIM-378.pdf&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></span> </li> <li id="cite_note-FOOTNOTEHyde1996§_6.6.2.2_SAR-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTEHyde1996§_6.6.2.2_SAR_16-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFHyde1996">Hyde 1996</a>, § 6.6.2.2 SAR.</span> </li> <li id="cite_note-FOOTNOTESteele1977-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTESteele1977_17-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFSteele1977">Steele 1977</a>.</span> </li> <li id="cite_note-FOOTNOTEISOIEC98991999§_6.5.7_Bitwise_shift_operators-18"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTEISOIEC98991999§_6.5.7_Bitwise_shift_operators_18-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFISOIEC98991999">ISOIEC9899 1999</a>, § 6.5.7 Bitwise shift operators.</span> </li> <li id="cite_note-FOOTNOTEFSF2008§_4.5_Integers_implementation-19"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTEFSF2008§_4.5_Integers_implementation_19-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFFSF2008">FSF 2008</a>, § 4.5 Integers implementation.</span> </li> <li id="cite_note-FOOTNOTEISOCPP202020§_7.6.7_Shift_operators-21"><span class="mw-cite-backlink"><b><a href="#cite_ref-FOOTNOTEISOCPP202020§_7.6.7_Shift_operators_21-0">^</a></b></span> <span class="reference-text"><a href="#CITEREFISOCPP202020">ISOCPP20 2020</a>, § 7.6.7 Shift operators.</span> </li> </ol></div> <div class="mw-heading mw-heading3"><h3 id="Sources_used">Sources used</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Arithmetic_shift&amp;action=edit&amp;section=9" title="Edit section: Sources used"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><style data-mw-deduplicate="TemplateStyles:r1041539562">.mw-parser-output .citation{word-wrap:break-word}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}</style><span class="citation 1037C"><span class="noviewer" typeof="mw:File"><span><img alt="Public Domain" src="//upload.wikimedia.org/wikipedia/en/thumb/6/62/PD-icon.svg/12px-PD-icon.svg.png" decoding="async" width="12" height="12" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/6/62/PD-icon.svg/18px-PD-icon.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/6/62/PD-icon.svg/24px-PD-icon.svg.png 2x" data-file-width="196" data-file-height="196" /></span></span>&#160;This article incorporates <a href="/wiki/Copyright_status_of_works_by_the_federal_government_of_the_United_States" title="Copyright status of works by the federal government of the United States">public domain material</a> from <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20220122224547/https://www.its.bldrdoc.gov/fs-1037/fs-1037c.htm"><i>Federal Standard 1037C</i></a>. <a href="/wiki/General_Services_Administration" title="General Services Administration">General Services Administration</a>. Archived from <a rel="nofollow" class="external text" href="https://www.its.bldrdoc.gov/fs-1037/fs-1037c.htm">the original</a> on 2022-01-22.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Federal+Standard+1037C&amp;rft.pub=General+Services+Administration&amp;rft_id=https%3A%2F%2Fwww.its.bldrdoc.gov%2Ffs-1037%2Ffs-1037c.htm&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></span> </p> <style data-mw-deduplicate="TemplateStyles:r1239549316">.mw-parser-output .refbegin{margin-bottom:0.5em}.mw-parser-output .refbegin-hanging-indents>ul{margin-left:0}.mw-parser-output .refbegin-hanging-indents>ul>li{margin-left:0;padding-left:3.2em;text-indent:-3.2em}.mw-parser-output .refbegin-hanging-indents ul,.mw-parser-output .refbegin-hanging-indents ul li{list-style:none}@media(max-width:720px){.mw-parser-output .refbegin-hanging-indents>ul>li{padding-left:1.6em;text-indent:-1.6em}}.mw-parser-output .refbegin-columns{margin-top:0.3em}.mw-parser-output .refbegin-columns ul{margin-top:0}.mw-parser-output .refbegin-columns li{page-break-inside:avoid;break-inside:avoid-column}@media screen{.mw-parser-output .refbegin{font-size:90%}}</style><div class="refbegin" style=""> <ul><li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFKnuth1969" class="citation book cs1"><a href="/wiki/Donald_Knuth" title="Donald Knuth">Knuth, Donald</a> (1969). <i><a href="/wiki/The_Art_of_Computer_Programming" title="The Art of Computer Programming">The Art of Computer Programming</a>, Volume 2 &#8212; Seminumerical algorithms</i>. Reading, Mass.: Addison-Wesley. pp.&#160;169–170.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=The+Art+of+Computer+Programming%2C+Volume+2+%26mdash%3B+Seminumerical+algorithms&amp;rft.place=Reading%2C+Mass.&amp;rft.pages=169-170&amp;rft.pub=Addison-Wesley&amp;rft.date=1969&amp;rft.aulast=Knuth&amp;rft.aufirst=Donald&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFSteele1977" class="citation journal cs1">Steele, Guy L. (November 1977). <a rel="nofollow" class="external text" href="https://web.archive.org/web/20170922201035/http://www.dtic.mil/get-tr-doc/pdf?AD=ADA031883">"Arithmetic shifting considered harmful"</a>. <i>ACM SIGPLAN Notices Archive</i>. <b>12</b> (11). New York: ACM Press: 61–69. <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F956641.956647">10.1145/956641.956647</a>. <a href="/wiki/Hdl_(identifier)" class="mw-redirect" title="Hdl (identifier)">hdl</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://hdl.handle.net/1721.1%2F6090">1721.1/6090</a></span>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a>&#160;<a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:15420308">15420308</a>. Archived from <a rel="nofollow" class="external text" href="http://www.dtic.mil/get-tr-doc/pdf?AD=ADA031883">the original</a> on September 22, 2017.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.jtitle=ACM+SIGPLAN+Notices+Archive&amp;rft.atitle=Arithmetic+shifting+considered+harmful&amp;rft.volume=12&amp;rft.issue=11&amp;rft.pages=61-69&amp;rft.date=1977-11&amp;rft_id=info%3Ahdl%2F1721.1%2F6090&amp;rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A15420308%23id-name%3DS2CID&amp;rft_id=info%3Adoi%2F10.1145%2F956641.956647&amp;rft.aulast=Steele&amp;rft.aufirst=Guy+L.&amp;rft_id=http%3A%2F%2Fwww.dtic.mil%2Fget-tr-doc%2Fpdf%3FAD%3DADA031883&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFHP2001" class="citation book cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20110808085326/http://h71000.www7.hp.com/doc/73final/4515/4515pro_002.html#8_arithmeticshiftoperator">"3.7.1 Arithmetic Shift Operator"</a>. <i>VAX MACRO and Instruction Set Reference Manual</i>. Hewlett-Packard Development Company. April 2001. Archived from <a rel="nofollow" class="external text" href="http://h71000.www7.hp.com/doc/73FINAL/4515/4515pro_002.html#8_arithmeticshiftoperator">the original</a> on 2011-08-08.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=bookitem&amp;rft.atitle=3.7.1+Arithmetic+Shift+Operator&amp;rft.btitle=VAX+MACRO+and+Instruction+Set+Reference+Manual&amp;rft.pub=Hewlett-Packard+Development+Company&amp;rft.date=2001-04&amp;rft_id=http%3A%2F%2Fh71000.www7.hp.com%2Fdoc%2F73FINAL%2F4515%2F4515pro_002.html%238_arithmeticshiftoperator&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span> <span class="cs1-visible-error citation-comment"><code class="cs1-code">{{<a href="/wiki/Template:Cite_book" title="Template:Cite book">cite book</a>}}</code>: </span><span class="cs1-visible-error citation-comment"><code class="cs1-code">&#124;work=</code> ignored (<a href="/wiki/Help:CS1_errors#periodical_ignored" title="Help:CS1 errors">help</a>)</span></li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFISOIEC98991999" class="citation book cs1"><i>Programming languages &#8212; C</i>. ISO/IEC 9899:1999. <a href="/wiki/International_Organization_for_Standardization" title="International Organization for Standardization">International Organization for Standardization</a>. 1999.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Programming+languages+%26mdash%3B+C&amp;rft.series=ISO%2FIEC+9899%3A1999&amp;rft.pub=International+Organization+for+Standardization&amp;rft.date=1999&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFHyde1996" class="citation book cs1">Hyde, Randall (1996-09-26). "CHAPTER SIX: THE 80x86 INSTRUCTION SET (Part 3)". <a rel="nofollow" class="external text" href="https://web.archive.org/web/20071123223102/http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter_6/CH06-3.html#HEADING3-120"><i>The Art of ASSEMBLY LANGUAGE PROGRAMMING</i></a>. Archived from <a rel="nofollow" class="external text" href="http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter_6/CH06-3.html#HEADING3-120">the original</a> on 2007-11-23<span class="reference-accessdate">. Retrieved <span class="nowrap">2007-11-28</span></span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=bookitem&amp;rft.atitle=CHAPTER+SIX%3A+THE+80x86+INSTRUCTION+SET+%28Part+3%29&amp;rft.btitle=The+Art+of+ASSEMBLY+LANGUAGE+PROGRAMMING&amp;rft.date=1996-09-26&amp;rft.aulast=Hyde&amp;rft.aufirst=Randall&amp;rft_id=http%3A%2F%2Fwww.arl.wustl.edu%2F~lockwood%2Fclass%2Fcs306%2Fbooks%2Fartofasm%2FChapter_6%2FCH06-3.html%23HEADING3-120&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFFSF2008" class="citation web cs1"><a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Integers-implementation.html#Integers-implementation">"C Implementation"</a>. <i>GCC manual</i>. <a href="/wiki/Free_Software_Foundation" title="Free Software Foundation">Free Software Foundation</a>. 2008.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=GCC+manual&amp;rft.atitle=C+Implementation&amp;rft.date=2008&amp;rft_id=https%3A%2F%2Fgcc.gnu.org%2Fonlinedocs%2Fgcc-4.3.3%2Fgcc%2FIntegers-implementation.html%23Integers-implementation&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></li> <li><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFISOCPP202020" class="citation web cs1"><a rel="nofollow" class="external text" href="https://isocpp.org/files/papers/N4860.pdf">"ISO/IEC 14882:2020(E) – Programming Language C++"</a> <span class="cs1-format">(PDF)</span>. International Organization for Standardization. 2020.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=ISO%2FIEC+14882%3A2020%28E%29+%E2%80%93+Programming+Language+C%2B%2B&amp;rft.pub=International+Organization+for+Standardization&amp;rft.date=2020&amp;rft_id=https%3A%2F%2Fisocpp.org%2Ffiles%2Fpapers%2FN4860.pdf&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AArithmetic+shift" class="Z3988"></span></li></ul> </div> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐f69cdc8f6‐szrlp Cached time: 20241124053301 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.393 seconds Real time usage: 0.498 seconds Preprocessor visited node count: 2032/1000000 Post‐expand include size: 37759/2097152 bytes Template argument size: 2902/2097152 bytes Highest expansion depth: 18/100 Expensive parser function count: 4/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 48485/5000000 bytes Lua time usage: 0.227/10.000 seconds Lua memory usage: 6521833/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 439.843 1 -total 27.41% 120.557 1 Template:Reflist 24.78% 108.983 8 Template:Cite_web 16.81% 73.933 1 Template:Short_description 15.89% 69.906 3 Template:Fix 15.77% 69.371 2 Template:Page_needed 13.28% 58.411 6 Template:Sfn 10.20% 44.867 2 Template:Pagetype 8.59% 37.800 1 Template:FS1037C 8.39% 36.885 6 Template:Delink --> <!-- Saved in parser cache with key enwiki:pcache:idhash:40725-0!canonical and timestamp 20241124053301 and revision id 1221514546. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=Arithmetic_shift&amp;oldid=1221514546">https://en.wikipedia.org/w/index.php?title=Arithmetic_shift&amp;oldid=1221514546</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="/wiki/Category:Binary_arithmetic" title="Category:Binary arithmetic">Binary arithmetic</a></li><li><a href="/wiki/Category:Operators_(programming)" title="Category:Operators (programming)">Operators (programming)</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:Wikipedia_articles_needing_page_number_citations_from_March_2012" title="Category:Wikipedia articles needing page number citations from March 2012">Wikipedia articles needing page number citations from March 2012</a></li><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_matches_Wikidata" title="Category:Short description matches Wikidata">Short description matches Wikidata</a></li><li><a href="/wiki/Category:All_articles_with_unsourced_statements" title="Category:All articles with unsourced statements">All articles with unsourced statements</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_August_2023" title="Category:Articles with unsourced statements from August 2023">Articles with unsourced statements from August 2023</a></li><li><a href="/wiki/Category:Wikipedia_articles_incorporating_text_from_the_Federal_Standard_1037C" title="Category:Wikipedia articles incorporating text from the Federal Standard 1037C">Wikipedia articles incorporating text from the Federal Standard 1037C</a></li><li><a href="/wiki/Category:CS1_errors:_periodical_ignored" title="Category:CS1 errors: periodical ignored">CS1 errors: periodical ignored</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 30 April 2024, at 11:36<span class="anonymous-show">&#160;(UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=Arithmetic_shift&amp;mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-f69cdc8f6-gzd6v","wgBackendResponseTime":158,"wgPageParseReport":{"limitreport":{"cputime":"0.393","walltime":"0.498","ppvisitednodes":{"value":2032,"limit":1000000},"postexpandincludesize":{"value":37759,"limit":2097152},"templateargumentsize":{"value":2902,"limit":2097152},"expansiondepth":{"value":18,"limit":100},"expensivefunctioncount":{"value":4,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":48485,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 439.843 1 -total"," 27.41% 120.557 1 Template:Reflist"," 24.78% 108.983 8 Template:Cite_web"," 16.81% 73.933 1 Template:Short_description"," 15.89% 69.906 3 Template:Fix"," 15.77% 69.371 2 Template:Page_needed"," 13.28% 58.411 6 Template:Sfn"," 10.20% 44.867 2 Template:Pagetype"," 8.59% 37.800 1 Template:FS1037C"," 8.39% 36.885 6 Template:Delink"]},"scribunto":{"limitreport-timeusage":{"value":"0.227","limit":"10.000"},"limitreport-memusage":{"value":6521833,"limit":52428800},"limitreport-logs":"anchor_id_list = table#1 {\n [\"CITEREFFSF2008\"] = 1,\n [\"CITEREFHP2001\"] = 1,\n [\"CITEREFHyde1996\"] = 1,\n [\"CITEREFISOCPP202020\"] = 1,\n [\"CITEREFISOIEC98991999\"] = 1,\n [\"CITEREFKnuth1969\"] = 1,\n [\"CITEREFSteele1977\"] = 1,\n [\"CITEREFSteele_Jr\"] = 1,\n}\ntemplate_list = table#1 {\n [\"Cite book\"] = 4,\n [\"Cite journal\"] = 1,\n [\"Cite web\"] = 8,\n [\"DEFAULTSORT:Arithmetic Shift\"] = 1,\n [\"FS1037C\"] = 1,\n [\"Fact\"] = 1,\n [\"Harvid\"] = 1,\n [\"Page needed\"] = 2,\n [\"Refbegin\"] = 1,\n [\"Refend\"] = 1,\n [\"Reflist\"] = 1,\n [\"Sfn\"] = 6,\n [\"Short description\"] = 1,\n}\narticle_whitelist = table#1 {\n}\n"},"cachereport":{"origin":"mw-web.codfw.main-f69cdc8f6-szrlp","timestamp":"20241124053301","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Arithmetic shift","url":"https:\/\/en.wikipedia.org\/wiki\/Arithmetic_shift","sameAs":"http:\/\/www.wikidata.org\/entity\/Q4791137","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q4791137","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2002-02-25T15:51:15Z","dateModified":"2024-04-30T11:36:23Z","image":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/3\/37\/Rotate_right_arithmetically.svg","headline":"shift operator in computer programming"}</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10