home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / tools / libs / graphics3d / src / library / graphics3dm68k.c < prev    next >
Encoding:
Text File  |  1998-04-13  |  607 b   |  28 lines

  1. /*
  2. **      $VER: graphics3Dm68k.c 10.00 (01.02.98)
  3. **
  4. **      Functions for graphics3D.library on a 68000
  5. **
  6. **    Note: this code is take from lib sources of C Compiler VBCC 
  7. **          
  8. */
  9.  
  10. /** divisione con segno tra numeri a 32bit **/
  11. long _ldivs(long z,long n)
  12. {
  13.     unsigned long uz,un,t=1;long q=0;int s=1;
  14.     if(!n) return(0);
  15.     if(z>=0) uz=z; else {uz=-z;s=-s;}
  16.     if(n>=0) un=n; else {un=-n;s=-s;}
  17.     while(un<=0xffffffff/2&&un<=uz/2){
  18.         t*=2;
  19.         un*=2;
  20.     }
  21.     while(t){
  22.         if(uz>=un){ q+=t; uz-=un;}
  23.         t/=2;
  24.         un/=2;
  25.     }
  26.     if(s>0) return(q); else return(-q);
  27. }
  28.