Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

NEED FAST SIGNED DIVISION on PPLAIN

How may i be able to break a signed division by a constant

into cheaper sequences of adds (and one imul, maybe)


For unsigned division we may use the following

formula:

a/b == (int)(((2^32)+b-1)/b) * (a) / (2^32)

but does it hold for signed division?

can anyone recall michael abrash's code for doing

fast signed division. i guess he had

discussed in the mar 92 issue of Dr dobb's.




Comments

  • Why don't you use IDIV (signed) or DIV (unsigned)? It takes one clock cycle, which is really fast. On a 90mhz comp, there are 90 million clock cycles per second.

    MOV AX, 8

    MOV BX, 4

    IDIV BX (or DIV BX)

    AX now equals 2


  • : Why don't you use IDIV (signed) or DIV (unsigned)? It takes one clock cycle, which is really fast. On a 90mhz comp, there are 90 million clock cycles per second.

    : MOV AX, 8

    : MOV BX, 4

    : IDIV BX (or DIV BX)

    : AX now equals 2


    yeah but all this is good on pII or PIII

    i am looking for a PPLAIN(pentium or i586

    or whatever you may call it)

    speed up.


  • I expected some answers to my query.

    But it seems readers of this forum are more interested in

    DOS & stuffs like that.


  • Justin BibJustin Bib USAMember Posts: 0

    _ { http://forcoder.org } free ebooks and video tutorials about ( PL/SQL, Go, Objective-C, Visual Basic, PHP, C++, Delphi, Java, Swift, R, Perl, Ruby, Scratch, C#, JavaScript, MATLAB, Python, C, Assembly, Visual Basic .NET Fortran, ABAP, Crystal, Kotlin, COBOL, Lisp, Julia, Erlang, Dart, Ada, F#, Transact-SQL, Apex, Scala, D, Scheme, Logo, Lua, LabVIEW, Bash, Awk, Hack, Rust, SAS, Clojure, Prolog, Alice, ML, VBScript, FoxPro )

Sign In or Register to comment.