Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Convert C to assembly

Status
Not open for further replies.

KH

Junior Member level 1
Joined
Nov 1, 2004
Messages
16
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,281
Activity points
103
convert c to assembly

In C command syntax, n++ is equivalent to n=n+1, but if convert to assembly will it be the same interms of code length and processing time ?
 

jjohn

Banned
Joined
Jun 17, 2006
Messages
158
Helped
17
Reputation
34
Reaction score
8
Trophy points
1,298
Activity points
0
convert c to asm

Just give incerement instruction of your processor and find cycle time clock freq..... !!
 

cherrytart

Advanced Member level 4
Joined
Feb 26, 2002
Messages
118
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,298
Location
oklahoma
Activity points
1,037
convert c to assembler

That would be compiler dependent. Compiling n=n+1 as an increment instruction is one of the rudimentary optimizations, as is using a shift for a multiplication by a power of 2 and ignoring do nothing statements ( n=n+0 or n=n*1)

Some compilers have switches to control the degree of optimazation.

Compilers also usually have switches to generate an assembly listing of the code they generate. Reading this listing can be a real eye opening experience.
 

sanjiv

Member level 1
Joined
Jan 4, 2006
Messages
40
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
1,614
convert command to assembly

It will depend upon complier you using.
 

jjohn

Banned
Joined
Jun 17, 2006
Messages
158
Helped
17
Reputation
34
Reaction score
8
Trophy points
1,298
Activity points
0
how to convert c to assembly

No ... Compiler has some over head .. Assembly will be faster ........
 

muller

Banned
Joined
Jul 3, 2006
Messages
1
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,281
Activity points
0
convert c assembly increment

Most of the compiler supports assembly listing use compiler switch to generate assembly see the simple inc operation produces quite a few code... it also depends on target processor .....
 

    KH

    Points: 2
    Helpful Answer Positive Rating

KH

Junior Member level 1
Joined
Nov 1, 2004
Messages
16
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,281
Activity points
103
asm convert to

KH said:
In C command syntax, n++ is equivalent to n=n+1, but if convert to assembly will it be the same interms of code length and processing time ?


If the compiler treats n=n+1 as the syntax of n=n+x, then maybe it makes a difference, n++ only need register increment, but n=n+1 will require direct addition of a constant.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top