Unsigned Right Shift Operator (>>>)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bill

    #1

    Unsigned Right Shift Operator (>>>)

    I am trying to convert a Java APP to C# and it appears C# does not have a[color=blue][color=green][color=darkred]
    >>> operator. Does anyone the best way to conver this operator in to c#?[/color][/color][/color]

    Thanks.

    --
    Bill


  • Simon Trew

    #2
    Re: Unsigned Right Shift Operator (>>> )

    Cast the variable to unsigned.

    e.g. if it is a "long":

    unsigned long result = ((unsigned long)myVariable ) >> myShift;

    BTW I have got so used to the new C++ style of casting, where the variable
    goes inside brackets and you therefore know unequivocally the scope of the
    cast, that I can't imagine why C# uses the old C-style casts.

    S.

    "Bill" <msgdev@hotmail .com> wrote in message
    news:eCumR4AYDH A.1492@TK2MSFTN GP12.phx.gbl...[color=blue]
    > I am trying to convert a Java APP to C# and it appears C# does not have a[color=green][color=darkred]
    > >>> operator. Does anyone the best way to conver this operator in to c#?[/color][/color]
    >
    > Thanks.
    >
    > --
    > Bill
    >
    >[/color]


    Comment

    • Simon Trew

      #3
      Re: Unsigned Right Shift Operator (&gt;&gt;&gt; )

      PS... perhaps you should be using an unsigned type in the first place?

      S.

      "Bill" <msgdev@hotmail .com> wrote in message
      news:eCumR4AYDH A.1492@TK2MSFTN GP12.phx.gbl...[color=blue]
      > I am trying to convert a Java APP to C# and it appears C# does not have a[color=green][color=darkred]
      > >>> operator. Does anyone the best way to conver this operator in to c#?[/color][/color]
      >
      > Thanks.
      >
      > --
      > Bill
      >
      >[/color]


      Comment

      Working...