-
Notifications
You must be signed in to change notification settings - Fork 0
/
compatibility.c
74 lines (56 loc) · 965 Bytes
/
compatibility.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* Implementations of missing functions
*
* FIXME: license
*/
#include "include/compatibility.h"
#ifndef __amigaos4__
#include "SDI_compiler.h"
#endif
#include <strings.h>
#include <stdlib.h>
#include <exec/types.h>
#if !defined(__SASC)
void swmem(char *dest, char *src, int s)
{
int i;
char c;
for(i=0; i<s; i++) {
c = dest[i];
dest[i] = src[i];
src[i] = c;
}
}
void strins(char *to, const char *from)
{
unsigned int toLength;
unsigned int fromLength;
char *newTo;
char *oldTo;
if (!to || !from)
return;
toLength = strlen(to);
fromLength = strlen(from);
newTo = to + fromLength + toLength;
oldTo = to + toLength;
toLength++;
while(toLength--) {
*newTo-- = *oldTo--;
}
while(fromLength--) {
*to++ = *from++;
}
}
static int dcomp(double *a, double *b)
{
if(*a>*b)
return 1;
else if(*a==*b)
return 0;
else
return -1;
}
void dqsort(double *x, int n)
{
qsort(x,n,sizeof(double),(void *)(*dcomp));
}
#endif