iAPX86 code for ABS (using Microsoft C?)
Alastair Dallas
awd at dbase.UUCP
Wed Jun 21 09:47:11 AEST 1989
In article <1202 at draken.nada.kth.se>, d88-eli at nada.kth.se (Erik Liljencrantz) writes:
> I remember a review of Microsoft's C compiler for MS-DOS that stated it
> produced no-conditional-jump-abs-code. The function to convert an integer
> to a positive integer was performed without a conditional jump (i.e. JS or
> something). I'm very interested in this piece of code, so if someone
> who does have a Microsoft C-compiler could try something like
> main()
> { int a,b;
> a=-10;
> b=abs(a);
> }
> and take a close look at the assembly code generated, I would appreciate
> that. This kind of reversed engineering (or what is it?) can't be illegal
> as it actually was published in a magazine some time ago (maybe two years
> so it must have been Microsoft C version 4.00 that was reviewed...)
This code, using Microsoft C v5.1, produces:
...
mov ax,FFF6
push ax
call _abs()
...
The abs() function uses conditional jumps. As for reverse engineering not
being illegal, I think you are probably mistaken. If I were to broadcast
here the code for the abs() function (which is trivial) so that people
who had not bought MSC could take and use (read: steal) it, it would be
wrong. On the other hand, if there were some trick code for doing this
on an Intel processor, and if it were in Microsoft (or any other) C,
I would bet the trick did not originate with the C vendor's compiler team.
There's a difference between research and various nastier terms.
/alastair/
Disclaimer: I speak for myself, only.
More information about the Comp.lang.c
mailing list