Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!usc!hacgate!ashtate!dbase!awd From: awd@dbase.UUCP (Alastair Dallas) Newsgroups: comp.lang.c Subject: Re: iAPX86 code for ABS (using Microsoft C?) Summary: MSC does not inline abs() Message-ID: <121@dbase.UUCP> Date: 20 Jun 89 23:47:11 GMT References: <1202@draken.nada.kth.se> Organization: Ashton Tate Devlopment Center Glendale, Calif. Lines: 36 In article <1202@draken.nada.kth.se>, d88-eli@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.