473,387 Members | 3,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to translate C++ pseudocode to MIPS assembly language instruction

(Can you translate this C++ pseuodoce to MIPS language
instruction?)

CountBits


# int count bits(int a0)
{
vo=0;
while (a0){
v0+= a0&1 > add $v0
a0 >> =1, > srav $a0,$a0,$at
}
return 0;

}
Oct 24 '10 #1
1 2717
donbock
2,426 Expert 2GB
The easiest way is to compile that program on a MIPS cross-compiler and capture the assembly output. On some compilers (for example, gcc) this is accomplished with the -S command line argument [I think].
Oct 25 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

26
by: nospam | last post by:
Just wondering, What do you think the difference in performance would be between (1.) Compiled C# (2.) Compiled C++ (3.) and Assembly Language And how would the mix be if some if any of...
8
by: Chin Fui | last post by:
I am writting a CD-ROM Emulator application using assembly language and link with the VB.NET interface. But, I am not sure whether assembly language is linkable with VB.NET. Another question is...
13
by: Robert Cloud | last post by:
Is it possible to include assembly language routines in C if I'm using a compiler which has an assembler such as gcc? could I include them in a main function or would I have to write a seperate...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.