Bitwise Operations and the Naming Convention of their Operators












0












$begingroup$


So I just recently came across a bitwise operation on StackOverflow which shifts the bits in a binary number to the right while zero-filling from the left. The left side zero-filling overwrites the sign bit, thus it always yields positive representations of a number (the result cannot be negative).



E.g.:



11010101 >>> 3



yields



00011010



According to the normal mathematical conventions for naming operators, would it be correct to call this an unsigned bitshift operator? I ask because it seems that this is not inherently an unsigned bitshift but just a zero-filling shift that overwrites (i.e. does not propagate) the sign bit. So, basically, it seems like although the result will always be unsigned it does not seem semantically correct to call the operator an unsigned bitshift operator. Another [lemma??] which I've run into that further supports the argument that this operator should not be called unsigned is that it can be used on both signed and unsigned operands.










share|cite|improve this question











$endgroup$












  • $begingroup$
    It sometimes fill ones from the right if there was a 1 in the signed bit and sometimes it fills zeros, it's system dependant (at least in C). Also, AFAIK, it's called bit shift (to the right) operator (C again).
    $endgroup$
    – shinzou
    Jun 2 '15 at 19:03












  • $begingroup$
    Yeah that makes sense to me to call it bit shift (to the right). The documentation I linked to seems to also [correctly?] call it a "zero-fill right shift" operator. The main reason I asked the question is that I've found it in certain documentation where it is referred to as the unsigned right shift operator.
    $endgroup$
    – Alex W
    Jun 2 '15 at 20:01


















0












$begingroup$


So I just recently came across a bitwise operation on StackOverflow which shifts the bits in a binary number to the right while zero-filling from the left. The left side zero-filling overwrites the sign bit, thus it always yields positive representations of a number (the result cannot be negative).



E.g.:



11010101 >>> 3



yields



00011010



According to the normal mathematical conventions for naming operators, would it be correct to call this an unsigned bitshift operator? I ask because it seems that this is not inherently an unsigned bitshift but just a zero-filling shift that overwrites (i.e. does not propagate) the sign bit. So, basically, it seems like although the result will always be unsigned it does not seem semantically correct to call the operator an unsigned bitshift operator. Another [lemma??] which I've run into that further supports the argument that this operator should not be called unsigned is that it can be used on both signed and unsigned operands.










share|cite|improve this question











$endgroup$












  • $begingroup$
    It sometimes fill ones from the right if there was a 1 in the signed bit and sometimes it fills zeros, it's system dependant (at least in C). Also, AFAIK, it's called bit shift (to the right) operator (C again).
    $endgroup$
    – shinzou
    Jun 2 '15 at 19:03












  • $begingroup$
    Yeah that makes sense to me to call it bit shift (to the right). The documentation I linked to seems to also [correctly?] call it a "zero-fill right shift" operator. The main reason I asked the question is that I've found it in certain documentation where it is referred to as the unsigned right shift operator.
    $endgroup$
    – Alex W
    Jun 2 '15 at 20:01
















0












0








0





$begingroup$


So I just recently came across a bitwise operation on StackOverflow which shifts the bits in a binary number to the right while zero-filling from the left. The left side zero-filling overwrites the sign bit, thus it always yields positive representations of a number (the result cannot be negative).



E.g.:



11010101 >>> 3



yields



00011010



According to the normal mathematical conventions for naming operators, would it be correct to call this an unsigned bitshift operator? I ask because it seems that this is not inherently an unsigned bitshift but just a zero-filling shift that overwrites (i.e. does not propagate) the sign bit. So, basically, it seems like although the result will always be unsigned it does not seem semantically correct to call the operator an unsigned bitshift operator. Another [lemma??] which I've run into that further supports the argument that this operator should not be called unsigned is that it can be used on both signed and unsigned operands.










share|cite|improve this question











$endgroup$




So I just recently came across a bitwise operation on StackOverflow which shifts the bits in a binary number to the right while zero-filling from the left. The left side zero-filling overwrites the sign bit, thus it always yields positive representations of a number (the result cannot be negative).



E.g.:



11010101 >>> 3



yields



00011010



According to the normal mathematical conventions for naming operators, would it be correct to call this an unsigned bitshift operator? I ask because it seems that this is not inherently an unsigned bitshift but just a zero-filling shift that overwrites (i.e. does not propagate) the sign bit. So, basically, it seems like although the result will always be unsigned it does not seem semantically correct to call the operator an unsigned bitshift operator. Another [lemma??] which I've run into that further supports the argument that this operator should not be called unsigned is that it can be used on both signed and unsigned operands.







operator-theory computer-science binary






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jun 2 '15 at 20:08







Alex W

















asked Jun 2 '15 at 17:48









Alex WAlex W

1034




1034












  • $begingroup$
    It sometimes fill ones from the right if there was a 1 in the signed bit and sometimes it fills zeros, it's system dependant (at least in C). Also, AFAIK, it's called bit shift (to the right) operator (C again).
    $endgroup$
    – shinzou
    Jun 2 '15 at 19:03












  • $begingroup$
    Yeah that makes sense to me to call it bit shift (to the right). The documentation I linked to seems to also [correctly?] call it a "zero-fill right shift" operator. The main reason I asked the question is that I've found it in certain documentation where it is referred to as the unsigned right shift operator.
    $endgroup$
    – Alex W
    Jun 2 '15 at 20:01




















  • $begingroup$
    It sometimes fill ones from the right if there was a 1 in the signed bit and sometimes it fills zeros, it's system dependant (at least in C). Also, AFAIK, it's called bit shift (to the right) operator (C again).
    $endgroup$
    – shinzou
    Jun 2 '15 at 19:03












  • $begingroup$
    Yeah that makes sense to me to call it bit shift (to the right). The documentation I linked to seems to also [correctly?] call it a "zero-fill right shift" operator. The main reason I asked the question is that I've found it in certain documentation where it is referred to as the unsigned right shift operator.
    $endgroup$
    – Alex W
    Jun 2 '15 at 20:01


















$begingroup$
It sometimes fill ones from the right if there was a 1 in the signed bit and sometimes it fills zeros, it's system dependant (at least in C). Also, AFAIK, it's called bit shift (to the right) operator (C again).
$endgroup$
– shinzou
Jun 2 '15 at 19:03






$begingroup$
It sometimes fill ones from the right if there was a 1 in the signed bit and sometimes it fills zeros, it's system dependant (at least in C). Also, AFAIK, it's called bit shift (to the right) operator (C again).
$endgroup$
– shinzou
Jun 2 '15 at 19:03














$begingroup$
Yeah that makes sense to me to call it bit shift (to the right). The documentation I linked to seems to also [correctly?] call it a "zero-fill right shift" operator. The main reason I asked the question is that I've found it in certain documentation where it is referred to as the unsigned right shift operator.
$endgroup$
– Alex W
Jun 2 '15 at 20:01






$begingroup$
Yeah that makes sense to me to call it bit shift (to the right). The documentation I linked to seems to also [correctly?] call it a "zero-fill right shift" operator. The main reason I asked the question is that I've found it in certain documentation where it is referred to as the unsigned right shift operator.
$endgroup$
– Alex W
Jun 2 '15 at 20:01












1 Answer
1






active

oldest

votes


















0












$begingroup$

Both $0$-filling and $1$-filling cases are referred to as bitshift operations. Calling the former an unsigned bitshift operator is ambiguous, as it is unclear what unsigned applies to (is it the bit, the bitshift, or the operator?).



If you want to make the description of the operator as unambiguous as possible, just use "unsigned bit-filling bitshift operator".






share|cite|improve this answer









$endgroup$














    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "69"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1309567%2fbitwise-operations-and-the-naming-convention-of-their-operators%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0












    $begingroup$

    Both $0$-filling and $1$-filling cases are referred to as bitshift operations. Calling the former an unsigned bitshift operator is ambiguous, as it is unclear what unsigned applies to (is it the bit, the bitshift, or the operator?).



    If you want to make the description of the operator as unambiguous as possible, just use "unsigned bit-filling bitshift operator".






    share|cite|improve this answer









    $endgroup$


















      0












      $begingroup$

      Both $0$-filling and $1$-filling cases are referred to as bitshift operations. Calling the former an unsigned bitshift operator is ambiguous, as it is unclear what unsigned applies to (is it the bit, the bitshift, or the operator?).



      If you want to make the description of the operator as unambiguous as possible, just use "unsigned bit-filling bitshift operator".






      share|cite|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        Both $0$-filling and $1$-filling cases are referred to as bitshift operations. Calling the former an unsigned bitshift operator is ambiguous, as it is unclear what unsigned applies to (is it the bit, the bitshift, or the operator?).



        If you want to make the description of the operator as unambiguous as possible, just use "unsigned bit-filling bitshift operator".






        share|cite|improve this answer









        $endgroup$



        Both $0$-filling and $1$-filling cases are referred to as bitshift operations. Calling the former an unsigned bitshift operator is ambiguous, as it is unclear what unsigned applies to (is it the bit, the bitshift, or the operator?).



        If you want to make the description of the operator as unambiguous as possible, just use "unsigned bit-filling bitshift operator".







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Dec 12 '18 at 10:03









        KlangenKlangen

        1,69811334




        1,69811334






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematics Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1309567%2fbitwise-operations-and-the-naming-convention-of-their-operators%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?