On Wed, 28 Apr 2004 at 23:50 +0200, Robert Seczkowski <[email protected]...:
> Horse and saddle to that guy who find what is wrong in below code:
> unsigned int oct2int(const char* oct){
> unsigned int ret = 0;
> int i,j=0,k,length = strlen(oct);
>
> for(i=length-1;i >= 0;i--){
> if((k=(oct[i]-'0')) > 0) ret += 1<<(3*j) * k;//8 = 2^3
> j++;
> }
> return ret;
> }
added fix of:
> asm("eint");
(I think the compiler will tries to give you the eint depending
on your compiler flags, I can't comment on why it didn't in your case)
So you're using hardware multiply, right?
....
> 8c96: 32 c2 dint
> 8c98: 03 43 nop
> 8c9a: 82 4b 32 01 mov r11, &0x0132 ;
> 8c9e: 82 4f 38 01 mov r15, &0x0138 ;
> 8ca2: 1e 42 3a 01 mov &0x013a,r14 ;0x013a
Check out
http://mspgcc.sourceforge.net/manual/x613.html
and
http://mspgcc.sourceforge.net/manual/c745.html#compiler-options
-mforce-hwmul
Force use of a hardware multiplier.
-mdisable-hwmul
Do not use the hardware multiplier.
-minline-hwmul
Issue inline code for 32-bit integer operations for
devices with a
hardware multiplier.
-mnoint-hwmul
Do not disable and enable interrupts around hardware
multiplier
operations. This makes multiplication faster when you
are certain no
hardware multiplier operations will occur at deeper
interrupt levels.