Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - fb39ca4

Pages: 1 ... 57 58 [59] 60 61 ... 126
871
Calculator C / Re: Fixed point division?
« on: June 20, 2011, 10:18:53 pm »
I would just use the routines with long long, but then I get compiler errors with newlib. Using your asm routines in a contest won't be a big deal, right? I might not have to use them, though, depending on how fast it runs.

872
Calculator C / Re: Fixed point division?
« on: June 20, 2011, 07:37:09 pm »
Wow that was a fail.
*facepalm* *bangs head on table*
I never thought of using short ints in there. Thanks for suggesting that, now it works fine. This seems kind of inefficient, but it'll have to do for now, until i find something faster.
now, to work on division...
would this work?
a1 = upper half of a, a2 = lower half of a, in the same way as the multiplication routine
a / b = (((a1 << 16) / b) << 16 + ((a2 << 16) / b)?

Here's some C code:
Code: [Select]
inline long div(long a, long b) {
  long a1 = a & 0xFFFF0000;
  short a2 = a;
  return ((a1 / b) << 16) + ((a << 16) / b);
}
With my testing, it seems to work okay, but can someone confirm it?

I really wish ARM processors just had a damn FPU now.

873
Computer Programming / Re: What's wrong with this code?
« on: June 20, 2011, 04:13:25 pm »
I thought char was 1 byte, int was 2, and long was 4 ???

874
Calculator C / Re: Fixed point division?
« on: June 20, 2011, 03:44:41 pm »
I have a multiplication routine which almost works. Basically, I isolate the upper and lower halves of a and b each to the bottom half of a new variable, use the FOIL method and add them together.
Code: [Select]
inline long mul(long a, long b) {
  long a1 = a >> 16;
  long a2 = a & 0x0000FFFF;
  long b1 = b >> 16;
  long b2 = b & 0x0000FFFF;
  return ((a1 * b1) << 16) + (a1 * b2) + (a2 * b1) + ((a2 + b2) << 16);
}
I tried to multiply 0x00028000 and 0x0002000 (2 * 2.5), but I got 0x80050000, it seems that the sign bit gets messed up. What am I doing wrong?

875
[FR] Hors-Sujet / Re: Un RickRoll à la française?
« on: June 20, 2011, 12:53:29 pm »
Non...Je souhaite je n'ai pas étudier français maintenant.

876
Humour and Jokes / Re: Linux Screen Capturer - Epic Fail
« on: June 20, 2011, 10:27:01 am »
Lol I wonder what Richard Stallman would think of that.

877
Calculator C / Re: Fixed point division?
« on: June 19, 2011, 08:36:18 pm »
The error messages disappear when I don't use long long, so I set about writing a division routine that does not use long long.
Can someone confirm this works?
Code: [Select]
inline long div(long a, long b) {
  long a1;
  a1 = a >> 16;
  a = (a << 16) / b;
  a1 = (a1 << 16) / b;
  return (a1 << 16) + a;
}

878
Humour and Jokes / Re: POKÉMON IN REAL LIFE!
« on: June 19, 2011, 05:00:33 pm »
I don't see any video, just a black screen, though I can hear the sound fine.

879
Calculator C / Re: Fixed point division?
« on: June 19, 2011, 03:49:14 pm »
Okay, I just removed the function from utils.c that gave the warning since I'm not using it anyways. I also tried using -nostdlib, and the compiler output looks normal, but I don't get a tns document. Also, not having 32 bit division will be an issue for me if I get -nostdlib working.

880
Humour and Jokes / Post epic fails YOU find over here!
« on: June 19, 2011, 02:39:13 pm »
Here's mine.
Its still on autocomplete. as of the time of this writing.

I'm talking about fails you find yourself, not copied from other people.

881
Humour and Jokes / Re: Linux Screen Capturer - Epic Fail
« on: June 19, 2011, 02:37:01 pm »
Found it!
Lol, lets put a windows only program on a list of linux programs! Pure genius! I wish I'd thought of that!

882
News / Re: nPlayer Released!
« on: June 19, 2011, 02:28:58 pm »
Full color slideshows!

883
Calculator C / Re: Fixed point division?
« on: June 19, 2011, 02:27:27 pm »
I was getting major errors so I replaced my multiply and divides with the ones in C you mentioned above, using long longs, and now I am getting errors when I compile:
Code: [Select]
$ make
nspire-gcc -Os -Wall -W -c main.c
main.c: In function 'main':
main.c:52:7: warning: unused variable 'oldtime'
main.c:51:7: warning: unused variable 'time'
main.c:46:8: warning: unused variable 'timer'
nspire-gcc -Os -Wall -W -c utils.c
utils.c: In function 'filesize':
utils.c:129:3: warning: passing argument 2 of 'stat' from incompatible pointer type
c:/ndless-v2.0/sdk/include/os.h:288:1: note: expected 'struct stat *' but argument is of type 'char *'
nspire-gcc -Os -Wall -W -c graphics.c
nspire-gcc -Os -Wall -W -c math.c
nspire-ld  main.o utils.o graphics.o math.o -o raycaster.elf
c:/program files/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.1\libgcc.a(unwind-arm.o): In function `get_eit_entry':
C:\msys\1.0\home\yagarto\gcc-build\arm-none-eabi\libgcc/../../../gcc-4.5.1/libgcc/../gcc/config/arm/unwind-arm.c:614: undefined reference to `__exidx_start'
C:\msys\1.0\home\yagarto\gcc-build\arm-none-eabi\libgcc/../../../gcc-4.5.1/libgcc/../gcc/config/arm/unwind-arm.c:614: undefined reference to `__exidx_end'
c:/program files/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib\libc.a(lib_a-abort.o): In function `abort':
C:\msys\1.0\home\yagarto\newlib-build\arm-none-eabi\newlib\libc\stdlib/../../../../../newlib-1.18.0/newlib/libc/stdlib/abort.c:63: undefined reference to `_exit'
c:/program files/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib\libc.a(lib_a-signalr.o): In function `_kill_r':
C:\msys\1.0\home\yagarto\newlib-build\arm-none-eabi\newlib\libc\reent/../../../../../newlib-1.18.0/newlib/libc/reent/signalr.c:61: undefined reference to `_kill'
c:/program files/yagarto/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/lib\libc.a(lib_a-signalr.o): In function `_getpid_r':
C:\msys\1.0\home\yagarto\newlib-build\arm-none-eabi\newlib\libc\reent/../../../../../newlib-1.18.0/newlib/libc/reent/signalr.c:96: undefined reference to `_getpid'
collect2: ld returned 1 exit status
make: *** [raycaster.tns] Error 1

884
I only read the ones for microwaves.

885
Other / Re: Windows 8
« on: June 19, 2011, 12:47:03 pm »
I wonder if they are finally going to drop 32 bit support now? (I mean for PCs, not tablets)

Pages: 1 ... 57 58 [59] 60 61 ... 126