Date: Mon, 04 Aug 1997 09:44:46 +1100 From: Bill Currie Subject: Re: FIXDIV for ASM In-reply-to: To: djgpp AT delorie DOT com Message-id: <199708032149.JAA12878@teleng1.tait.co.nz gatekeeper.tait.co.nz> Organization: Tait Electronics Limited MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Comments: Authenticated sender is Precedence: bulk On 2 Aug 97 at 23:02, Georg Kolling wrote: > Mark Goodwin schrieb: > > inline static long FIXDIV(long Num, long Denom) > > { > > long Result; > > asm ("movl Num, %%eax;" > > "movl %%eax, %%edx;" > > "sarl %%edx, 16;" > > "shll %%eax, 16;" > > "idivl Denom" > > You just have to use _Num and _Denom! Nope, uses extended asm instead (Mark was getting close): asm ("movl %1, %%eax;" "movl %%eax, %%edx;" "sarl %%edx, 16;" "shll %%eax, 16;" "idivl %2" :"=a"(Result) /* output */ :"g"(Num),"g"(Denom) /* input */ :"%edx" /* modified */ ); Bill -- Leave others their otherness.