sparc/sunos support: rename quad to quadint. courtesy of Martin Schaffner <maschaffner@gmx.ch>
This commit is contained in:
parent
a92497a71f
commit
2ebf9b42cc
|
@ -1,4 +1,4 @@
|
|||
/* $Id: points.c,v 1.4 2002-07-17 21:55:19 bradleyb Exp $ */
|
||||
/* $Id: points.c,v 1.5 2002-10-28 19:49:15 btb Exp $ */
|
||||
/*
|
||||
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||
|
@ -37,7 +37,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#endif
|
||||
|
||||
#ifdef RCS
|
||||
static char rcsid[] = "$Id: points.c,v 1.4 2002-07-17 21:55:19 bradleyb Exp $";
|
||||
static char rcsid[] = "$Id: points.c,v 1.5 2002-10-28 19:49:15 btb Exp $";
|
||||
#endif
|
||||
|
||||
#include "3d.h"
|
||||
|
@ -91,7 +91,7 @@ ubyte g3_rotate_point(g3s_point *dest,vms_vector *src)
|
|||
//returns true if div is ok, else false
|
||||
int checkmuldiv(fix *r,fix a,fix b,fix c)
|
||||
{
|
||||
quad q,qt;
|
||||
quadint q,qt;
|
||||
|
||||
q.low=q.high=0;
|
||||
fixmulaccum(&q,a,b);
|
||||
|
@ -211,7 +211,7 @@ ubyte g3_add_delta_vec(g3s_point *dest,g3s_point *src,vms_vector *deltav)
|
|||
//calculate the depth of a point - returns the z coord of the rotated point
|
||||
fix g3_calc_point_depth(vms_vector *pnt)
|
||||
{
|
||||
quad q;
|
||||
quadint q;
|
||||
|
||||
q.low=q.high=0;
|
||||
fixmulaccum(&q,(pnt->x - View_position.x),View_matrix.fvec.x);
|
||||
|
|
|
@ -21,12 +21,12 @@ int d_rand (); // Random number function which returns in the range 0-0x7FFF
|
|||
typedef int32_t fix; //16 bits int, 16 bits frac
|
||||
typedef int16_t fixang; //angles
|
||||
|
||||
typedef struct quad
|
||||
typedef struct quadint // integer 64 bit, previously called "quad"
|
||||
{
|
||||
u_int32_t low;
|
||||
int32_t high;
|
||||
}
|
||||
quad;
|
||||
quadint;
|
||||
|
||||
|
||||
//Convert an int to a fix
|
||||
|
@ -162,22 +162,22 @@ fixmuldiv (fix a, fix b, fix c)
|
|||
|
||||
#endif
|
||||
|
||||
//multiply two fixes, and add 64-bit product to a quad
|
||||
void fixmulaccum (quad * q, fix a, fix b);
|
||||
//multiply two fixes, and add 64-bit product to a quadint
|
||||
void fixmulaccum (quadint * q, fix a, fix b);
|
||||
|
||||
//extract a fix from a quad product
|
||||
fix fixquadadjust (quad * q);
|
||||
//extract a fix from a quadint product
|
||||
fix fixquadadjust (quadint * q);
|
||||
|
||||
//divide a quad by a long
|
||||
//divide a quadint by a long
|
||||
int32_t fixdivquadlong (u_int32_t qlow, u_int32_t qhigh, u_int32_t d);
|
||||
|
||||
//negate a quad
|
||||
void fixquadnegate (quad * q);
|
||||
//negate a quadint
|
||||
void fixquadnegate (quadint * q);
|
||||
|
||||
//computes the square root of a long, returning a short
|
||||
ushort long_sqrt (int32_t a);
|
||||
|
||||
//computes the square root of a quad, returning a long
|
||||
//computes the square root of a quadint, returning a long
|
||||
u_int32_t quad_sqrt (u_int32_t low, int32_t high);
|
||||
//ulong quad_sqrt (long low, long high);
|
||||
|
||||
|
|
|
@ -49,6 +49,11 @@ typedef uint16_t u_int16_t;
|
|||
#ifdef __MACOSX__
|
||||
typedef unsigned long ulong;
|
||||
#endif
|
||||
#if defined(__sparc__) || defined(sparc)
|
||||
typedef uint64_t u_int64_t;
|
||||
typedef uint32_t u_int32_t;
|
||||
typedef uint16_t u_int16_t;
|
||||
#endif
|
||||
|
||||
#elif defined __DJGPP__
|
||||
# include <sys/types.h>
|
||||
|
|
21
maths/fixc.c
21
maths/fixc.c
|
@ -12,13 +12,16 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
*/
|
||||
/*
|
||||
* $Source: /cvs/cvsroot/d2x/maths/fixc.c,v $
|
||||
* $Revision: 1.3 $
|
||||
* $Author: bradleyb $
|
||||
* $Date: 2001-10-31 07:41:54 $
|
||||
* $Revision: 1.4 $
|
||||
* $Author: btb $
|
||||
* $Date: 2002-10-28 19:49:15 $
|
||||
*
|
||||
* C version of fixed point library
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.3 2001/10/31 07:41:54 bradleyb
|
||||
* Sync with d1x
|
||||
*
|
||||
* Revision 1.2 2001/01/31 15:18:04 bradleyb
|
||||
* Makefile and conf.h fixes
|
||||
*
|
||||
|
@ -69,7 +72,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#endif
|
||||
|
||||
#ifdef RCS
|
||||
static char rcsid[] = "$Id: fixc.c,v 1.3 2001-10-31 07:41:54 bradleyb Exp $";
|
||||
static char rcsid[] = "$Id: fixc.c,v 1.4 2002-10-28 19:49:15 btb Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -93,14 +96,14 @@ extern ushort acos_table[];
|
|||
extern fix isqrt_guess_table[];
|
||||
|
||||
//negate a quad
|
||||
void fixquadnegate(quad *q)
|
||||
void fixquadnegate(quadint *q)
|
||||
{
|
||||
q->low = 0 - q->low;
|
||||
q->high = 0 - q->high - (q->low != 0);
|
||||
}
|
||||
|
||||
//multiply two ints & add 64-bit result to 64-bit sum
|
||||
void fixmulaccum(quad *q,fix a,fix b)
|
||||
void fixmulaccum(quadint *q,fix a,fix b)
|
||||
{
|
||||
u_int32_t aa,bb;
|
||||
u_int32_t ah,al,bh,bl;
|
||||
|
@ -135,7 +138,7 @@ void fixmulaccum(quad *q,fix a,fix b)
|
|||
}
|
||||
|
||||
//extract a fix from a quad product
|
||||
fix fixquadadjust(quad *q)
|
||||
fix fixquadadjust(quadint *q)
|
||||
{
|
||||
return (q->high<<16) + (q->low>>16);
|
||||
}
|
||||
|
@ -219,7 +222,7 @@ fixang fix_atan2(fix cos,fix sin)
|
|||
}
|
||||
|
||||
#ifdef NO_FIX_INLINE
|
||||
//divide a quad by a fix, returning a fix
|
||||
//divide a quadint by a fix, returning a fix
|
||||
int32_t fixdivquadlong(u_int32_t nl,u_int32_t nh,u_int32_t d)
|
||||
{
|
||||
int i;
|
||||
|
@ -347,7 +350,7 @@ u_int32_t quad_sqrt(u_int32_t low,int32_t high)
|
|||
{
|
||||
int i, cnt;
|
||||
u_int32_t r,old_r,t;
|
||||
quad tq;
|
||||
quadint tq;
|
||||
|
||||
if (high<0)
|
||||
return 0;
|
||||
|
|
|
@ -12,13 +12,16 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
*/
|
||||
/*
|
||||
* $Source: /cvs/cvsroot/d2x/maths/vecmat.c,v $
|
||||
* $Revision: 1.3 $
|
||||
* $Author: bradleyb $
|
||||
* $Date: 2001-10-31 07:41:54 $
|
||||
* $Revision: 1.4 $
|
||||
* $Author: btb $
|
||||
* $Date: 2002-10-28 19:49:15 $
|
||||
*
|
||||
* C version of vecmat library
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.3 2001/10/31 07:41:54 bradleyb
|
||||
* Sync with d1x
|
||||
*
|
||||
* Revision 1.2 2001/01/31 15:18:04 bradleyb
|
||||
* Makefile and conf.h fixes
|
||||
*
|
||||
|
@ -57,7 +60,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|||
#endif
|
||||
|
||||
#ifdef RCS
|
||||
static char rcsid[] = "$Id: vecmat.c,v 1.3 2001-10-31 07:41:54 bradleyb Exp $";
|
||||
static char rcsid[] = "$Id: vecmat.c,v 1.4 2002-10-28 19:49:15 btb Exp $";
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -208,7 +211,7 @@ vms_vector *vm_vec_scale2(vms_vector *dest,fix n,fix d)
|
|||
|
||||
fix vm_vec_dotprod(vms_vector *v0,vms_vector *v1)
|
||||
{
|
||||
quad q;
|
||||
quadint q;
|
||||
|
||||
q.low = q.high = 0;
|
||||
|
||||
|
@ -221,7 +224,7 @@ fix vm_vec_dotprod(vms_vector *v0,vms_vector *v1)
|
|||
|
||||
fix vm_vec_dot3(fix x,fix y,fix z,vms_vector *v)
|
||||
{
|
||||
quad q;
|
||||
quadint q;
|
||||
|
||||
q.low = q.high = 0;
|
||||
|
||||
|
@ -235,7 +238,7 @@ fix vm_vec_dot3(fix x,fix y,fix z,vms_vector *v)
|
|||
//returns magnitude of a vector
|
||||
fix vm_vec_mag(vms_vector *v)
|
||||
{
|
||||
quad q;
|
||||
quadint q;
|
||||
|
||||
q.low = q.high = 0;
|
||||
|
||||
|
@ -341,7 +344,7 @@ fix vm_vec_copy_normalize_quick(vms_vector *dest,vms_vector *src)
|
|||
//returns approximation of 1/magnitude of a vector
|
||||
fix vm_vec_imag(vms_vector *v)
|
||||
{
|
||||
quad q;
|
||||
quadint q;
|
||||
|
||||
q.low = q.high = 0;
|
||||
|
||||
|
@ -497,7 +500,7 @@ vms_vector *vm_vec_crossprod(vms_vector *dest,vms_vector *src0,vms_vector *src1)
|
|||
|
||||
vms_vector *vm_vec_crossprod(vms_vector *dest,vms_vector *src0,vms_vector *src1)
|
||||
{
|
||||
quad q;
|
||||
quadint q;
|
||||
|
||||
Assert(dest!=src0 && dest!=src1);
|
||||
|
||||
|
|
Loading…
Reference in a new issue