Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 1204 → Rev 1205

/polymer/eduke32/build/src/pragmas.c
10,7 → 10,7
//#include "pragmas.h"
#include "compat.h"
 
int dmval;
int32_t dmval;
 
#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // NOASM
 
21,7 → 21,7
#define ASM __asm__ __volatile__
 
 
int boundmulscale(int a, int b, int c)
int32_t boundmulscale(int32_t a, int32_t b, int32_t c)
{
ASM(
"imull %%ebx\n\t"
47,7 → 47,7
}
 
 
void clearbufbyte(void *D, int c, int a)
void clearbufbyte(void *D, int32_t c, int32_t a)
{
ASM(
"cmpl $4, %%ecx\n\t"
88,7 → 88,7
);
}
 
void copybufbyte(void *S, void *D, int c)
void copybufbyte(void *S, void *D, int32_t c)
{
ASM(
"cmpl $4, %%ecx\n\t" // cmp ecx, 4
129,7 → 129,7
);
}
 
void copybufreverse(void *S, void *D, int c)
void copybufreverse(void *S, void *D, int32_t c)
{
ASM(
"shrl $1, %%ecx\n\t"
181,36 → 181,36
// Generic C version
//
 
void qinterpolatedown16(intptr_t bufptr, int num, int val, int add)
void qinterpolatedown16(intptr_t bufptr, int32_t num, int32_t val, int32_t add)
{
// gee, I wonder who could have provided this...
int i, *lptr = (int *)bufptr;
int32_t i, *lptr = (int32_t *)bufptr;
for (i=0;i<num;i++) { lptr[i] = (val>>16); val += add; }
}
 
void qinterpolatedown16short(intptr_t bufptr, int num, int val, int add)
void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t add)
{
// ...maybe the same person who provided this too?
int i; short *sptr = (short *)bufptr;
for (i=0;i<num;i++) { sptr[i] = (short)(val>>16); val += add; }
int32_t i; int16_t *sptr = (int16_t *)bufptr;
for (i=0;i<num;i++) { sptr[i] = (int16_t)(val>>16); val += add; }
}
 
void clearbuf(void *d, int c, int a)
void clearbuf(void *d, int32_t c, int32_t a)
{
int *p = (int*)d;
int32_t *p = (int32_t*)d;
while ((c--) > 0) *(p++) = a;
}
 
void copybuf(void *s, void *d, int c)
void copybuf(void *s, void *d, int32_t c)
{
int *p = (int*)s, *q = (int*)d;
int32_t *p = (int32_t*)s, *q = (int32_t*)d;
while ((c--) > 0) *(q++) = *(p++);
}
 
void swapbuf4(void *a, void *b, int c)
void swapbuf4(void *a, void *b, int32_t c)
{
int *p = (int*)a, *q = (int*)b;
int x, y;
int32_t *p = (int32_t*)a, *q = (int32_t*)b;
int32_t x, y;
while ((c--) > 0)
{
x = *q;
220,27 → 220,27
}
}
 
void clearbufbyte(void *D, int c, int a)
void clearbufbyte(void *D, int32_t c, int32_t a)
{
// Cringe City
char *p = (char*)D;
int m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l };
int n[4] = { 0,8,16,24 };
int z=0;
int32_t m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l };
int32_t n[4] = { 0,8,16,24 };
int32_t z=0;
while ((c--) > 0)
{
*(p++) = (char)((a & m[z])>>n[z]);
*(p++) = (uint8_t)((a & m[z])>>n[z]);
z=(z+1)&3;
}
}
 
void copybufbyte(void *S, void *D, int c)
void copybufbyte(void *S, void *D, int32_t c)
{
char *p = (char*)S, *q = (char*)D;
while ((c--) > 0) *(q++) = *(p++);
}
 
void copybufreverse(void *S, void *D, int c)
void copybufreverse(void *S, void *D, int32_t c)
{
char *p = (char*)S, *q = (char*)D;
while ((c--) > 0) *(q++) = *(p--);