64-bit addressing
There is a guy on the Apple forums that wonders why this code does not compile. I tried it and it compiles with the variable A declared as long but not as long long or double.
#include <stdio.h>
#include <math.h>
#define X 128
#define Y 128
#define Z 128
#define T 129
long long A[X][Y][Z][T];
int x, y, z, t;
main() {
printf("\
program uses %g MBytes\
",X*Y*Z*T*8.0/1.0e6);
for (x=0;x<X;++x) {
for (y=0;y<Y;++y) {
for (z=0;z<Z;++z) {
for (t=0;t<T;++t) {
A[x][y][z][t]=sin(x+1)/sin(y+1)/sin(z+1)/sin(t+1);
}
}
}
}
}
lundys-Dual-G5:~/Desktop lundy$ gcc -fast -mpowerpc64 Test.c
Test.c:8: error: size of variable `A' is too large
lundys-Dual-G5:~/Desktop lundy$
Seems to me that 36-bit addressing should do it. Any clues?
Code:
#include <stdio.h>
#include <math.h>
#define X 128
#define Y 128
#define Z 128
#define T 129
long long A[X][Y][Z][T];
int x, y, z, t;
main() {
printf("\
program uses %g MBytes\
",X*Y*Z*T*8.0/1.0e6);
for (x=0;x<X;++x) {
for (y=0;y<Y;++y) {
for (z=0;z<Z;++z) {
for (t=0;t<T;++t) {
A[x][y][z][t]=sin(x+1)/sin(y+1)/sin(z+1)/sin(t+1);
}
}
}
}
}
lundys-Dual-G5:~/Desktop lundy$ gcc -fast -mpowerpc64 Test.c
Test.c:8: error: size of variable `A' is too large
lundys-Dual-G5:~/Desktop lundy$
Seems to me that 36-bit addressing should do it. Any clues?
Comments