LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-20-2008, 10:22 PM   #1
cyborgt
LQ Newbie
 
Registered: Feb 2008
Posts: 5

Rep: Reputation: 0
Question about Binary search on mips.


Hi, guys, i am back again with the question about making a simple non recursive binary search for 8 sorted numbers. I am studying 3 classes now, one class require c++ programing, one reqire java monitor programing, and another one require assembly, I really can't deal with all of them at once...... anyway, i wrote the code in C++, then tried to translate it to mips... but damn, i have no idea how, then i tried to just use the mips.. but still, i confused myself within 7 lines...... would anybody please help?
 
Old 02-20-2008, 10:47 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Why not use a C++ compiler and then hand edit the result?
 
Old 02-21-2008, 04:01 PM   #3
cyborgt
LQ Newbie
 
Registered: Feb 2008
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by osor View Post
Why not use a C++ compiler and then hand edit the result?
man, i hope i can do that, but i couldn't .... please help.. anybody...
 
Old 02-21-2008, 05:41 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by cyborgt View Post
man, i hope i can do that, but i couldn't .... please help.. anybody...
What did you try so far? How about:
Code:
mips-linux-gnu-g++ -S binarysearch.cc
So assuming your C++ sourcefile is binarysearch.cc, you should will get a mips assembly file called binarysearch.s. You can obviously add all architecture-specific options outlined in the g++ manpage.

Also, make sure you sanitize your C++ code to be as self-sufficient as possible (e.g., remove all use of the STL, and most library functions). That way, instead of having your assembly code be a bunch of function calls, you will have a self-contained piece of code (except for obvious things like writing to stdout).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Binary search tree in C Zeno McDohl Programming 3 01-27-2008 05:07 PM
LXer: Mips processors gain GNU/Linux binary prelinker LXer Syndicated Linux News 0 11-01-2006 12:33 PM
LXer: CodeSourcery Joins MIPS(R) Alliance Program and Delivers GNU/Linux Prelinker for MIPS-Based(TM) Processors LXer Syndicated Linux News 0 10-31-2006 07:54 PM
MIPS question... kponenation Programming 10 10-04-2005 01:21 AM
MIPS assembly question Gnute Programming 1 08-24-2004 05:33 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration