By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

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

P: 1
(Can you translate this C++ pseuodoce to MIPS language


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

Oct 24 '10 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 2,396
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

Post your reply

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