Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the C# equivalent of Java unsigned right shift operator >>>

Tags:

I am trying to convert some Java code to C#. How can the following unsigned right shift operation be represented in C#?

int src1, src2, ans; ans = src1 >>> src2; 
like image 940
blitzkriegz Avatar asked Nov 14 '11 16:11

blitzkriegz


People also ask

What is C used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is C language in simple words?

C is a structured, procedural programming language that has been widely used both for operating systems and applications and that has had a wide following in the academic community. Many versions of UNIX-based operating systems are written in C.

What does computer C mean?

Mean? The C drive (C:) is the main hard disk partition which contains the operating system and the related system files. In Windows operating systems, the C drive as represented as “C:\”, the backlash representing the root directory of the drive.


1 Answers

You have to cast first, there is not one operator for >>>, code sample:

 int x = -100;  int y = (int)((uint)x >> 2);  Console.WriteLine(y); 
like image 59
Peter Avatar answered Oct 13 '22 00:10

Peter