Mercurial > projects > ldc
annotate dmd/gnuc.c @ 920:545f54041d91
Implemented proper support for naked asm using llvm module level asm. Still not 100% complete, but already 1000 times better that what we had before. Don's BignumX86 implementation from Tango (when turned into a standalone unittest) seems to fully work with no changes, and great performance :)
Fixed align N; in asm blocks.
Fixed inreg parameter passing on x86 for ref/out params.
Removed support for lazy initialization of function local static variables, I have no idea why I ever implemented this, it's not in the D spec, and DMD doesn't support it :P
Some of the global variable related changes might cause minor regressions, but they should be easily fixable.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 03 Feb 2009 08:54:57 +0100 |
parents | c53b6e3fe49a |
children |
rev | line source |
---|---|
1 | 1 |
2 // Put functions in here missing from gnu C | |
3 | |
4 #include "gnuc.h" | |
5 | |
6 int memicmp(const char *s1, const char *s2, int n) | |
7 { | |
8 int result = 0; | |
9 | |
10 for (int i = 0; i < n; i++) | |
11 { char c1 = s1[i]; | |
12 char c2 = s2[i]; | |
13 | |
14 result = c1 - c2; | |
15 if (result) | |
16 { | |
17 if ('A' <= c1 && c1 <= 'Z') | |
18 c1 += 'a' - 'A'; | |
19 if ('A' <= c2 && c2 <= 'Z') | |
20 c2 += 'a' - 'A'; | |
21 result = c1 - c2; | |
22 if (result) | |
23 break; | |
24 } | |
25 } | |
26 return result; | |
27 } | |
28 | |
29 int stricmp(const char *s1, const char *s2) | |
30 { | |
31 int result = 0; | |
32 | |
33 for (;;) | |
34 { char c1 = *s1; | |
35 char c2 = *s2; | |
36 | |
37 result = c1 - c2; | |
38 if (result) | |
39 { | |
40 if ('A' <= c1 && c1 <= 'Z') | |
41 c1 += 'a' - 'A'; | |
42 if ('A' <= c2 && c2 <= 'Z') | |
43 c2 += 'a' - 'A'; | |
44 result = c1 - c2; | |
45 if (result) | |
46 break; | |
47 } | |
48 if (!c1) | |
49 break; | |
50 s1++; | |
51 s2++; | |
52 } | |
53 return result; | |
54 } | |
55 |