Mercurial > projects > ldc
view dmd2/gnuc.c @ 1004:45ed9e125a00
Remove initialization of padding of reals, ireals and creals.
According to the spec and C ABIs, the contents of padding is undefined.
This was breaking dstress creal_01,02,03,07,08,09 and 20 on x86-64.
The code was apparently added to fix creal_13,14 and 15, which explicitly
compare padding and assert if it's different. I'd argue those tests are broken.
(Also, on x86-64 they *also* fail)
The tests this fixes, on the other hand, are basic arithmetic.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Fri, 27 Feb 2009 19:41:25 +0100 |
parents | f04dde6e882c |
children |
line wrap: on
line source
// Put functions in here missing from gnu C #include "gnuc.h" int memicmp(const char *s1, const char *s2, int n) { int result = 0; for (int i = 0; i < n; i++) { char c1 = s1[i]; char c2 = s2[i]; result = c1 - c2; if (result) { if ('A' <= c1 && c1 <= 'Z') c1 += 'a' - 'A'; if ('A' <= c2 && c2 <= 'Z') c2 += 'a' - 'A'; result = c1 - c2; if (result) break; } } return result; } int stricmp(const char *s1, const char *s2) { int result = 0; for (;;) { char c1 = *s1; char c2 = *s2; result = c1 - c2; if (result) { if ('A' <= c1 && c1 <= 'Z') c1 += 'a' - 'A'; if ('A' <= c2 && c2 <= 'Z') c2 += 'a' - 'A'; result = c1 - c2; if (result) break; } if (!c1) break; s1++; s2++; } return result; }