Path: chuka.playstation.co.uk!news From: john.rees@dial.pipex.com Newsgroups: scee.yaroze.programming.gnu_compiler Subject: long long ints for improved accuracy Date: Mon, 15 Dec 1997 13:19:54 GMT Organization: PlayStation Net Yaroze (SCEE) Lines: 54 Message-ID: <673auk$9k35@chuka.playstation.co.uk> NNTP-Posting-Host: aa172.du.pipex.com X-Newsreader: Forte Free Agent 1.0.82 I am trying to use long long ints to hold temporary values during fixed point calculations, but if I use divide and modulus operations then the linker complains that certain functions are not found. gcc basic.o -Xlinker -Map -Xlinker mapfile -Xlinker -Ttext -Xlinker 80100000 -o basic basic.o: In function `main': basic.c:11: undefined reference to `__divdi3' basic.c:11: relocation truncated to fit: JMPADDR __divdi3 basic.c:12: undefined reference to `__moddi3' basic.c:12: relocation truncated to fit: JMPADDR __moddi3 make.exe: *** [basic] Error 1 It is strange that add, subtract and multiply seem to work, but divide and modulus are not provided. Even if these would be slow to execute on a 32 bit machine, it would be VERY useful. #include #define printll(v) printf(#v "=%08x %08x\n", *(((int*)&v)+1), *(int*)&v ) int main(void) { long long x = 0x123456; long long y = 0x100000; long long prod = (x-y)*y; long long quot = x/y; long long rem = x%y; printll(x); printll(y); printll(prod); printll(quot); printll(rem); return 0; } With the "quot" and "rem" lines commented out, the output is: x=00000000 00123456 y=00000000 00100000 prod=00000023 45600000 Thanks to Alex Amsel for a throwaway remark in the More Pointless Optimisation Tricks thread that made me aware of long longs. After struggling with fixed point numbers for far too many hours I really hope someone can help with this. john