Changeset 43 for abuse/trunk
- Timestamp:
- Mar 2, 2008, 1:58:48 AM (14 years ago)
- Location:
- abuse/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
abuse/trunk/src/calctrig.cpp
r2 r43 4 4 { 5 5 int i,x; 6 printf(" longsin_table[360]={\n ");6 printf("int32_t sin_table[360]={\n "); 7 7 for (i=0;i<360;i++) 8 8 { … … 13 13 printf("};\n"); 14 14 15 printf("u nsigned short atan_table[1662]={\n ");15 printf("uint16_t atan_table[1662]={\n "); 16 16 17 17 for (i=1;i<1662;i++) -
abuse/trunk/src/include/lisp.hpp
r39 r43 21 21 22 22 #define FIXED_TRIG_SIZE 360 // 360 degrees stored in table 23 extern longsin_table[FIXED_TRIG_SIZE]; // this should be filled in by external module23 extern int32_t sin_table[FIXED_TRIG_SIZE]; // this should be filled in by external module 24 24 #define TBS 1662 // atan table granularity 25 extern u nsigned short atan_table[TBS];25 extern uint16_t atan_table[TBS]; 26 26 #define NILP(x) (x==NULL) 27 27 #define DEFINEDP(x) (x!=l_undefined) … … 197 197 extern int space_size[4]; 198 198 void *nth(int num, void *list); 199 long lisp_atan2(long dy, longdx);200 long lisp_sin(longx);201 long lisp_cos(longx);199 int32_t lisp_atan2(int32_t dy, int32_t dx); 200 int32_t lisp_sin(int32_t x); 201 int32_t lisp_cos(int32_t x); 202 202 void restore_heap(void *val, int heap); 203 203 void *mark_heap(int heap); -
abuse/trunk/src/include/lisp2.hpp
r39 r43 62 62 63 63 #define FIXED_TRIG_SIZE 360 // 360 degrees stored in table 64 extern longsin_table[FIXED_TRIG_SIZE]; // this should be filled in by external module64 extern int32_t sin_table[FIXED_TRIG_SIZE]; // this should be filled in by external module 65 65 #define TBS 1662 // atan table granularity 66 extern u nsigned short atan_table[TBS];66 extern uint16_t atan_table[TBS]; 67 67 68 68 /* ------------------------- COMPATIBILITY -------------------- */ … … 111 111 char* symbol_name (void* symbol); 112 112 int item_type (void* cell); 113 long lisp_cos(longx);114 long lisp_sin(longx);115 long lisp_atan2(long dy, longdx);113 int32_t lisp_cos(int32_t x); 114 int32_t lisp_sin(int32_t x); 115 int32_t lisp_atan2(int32_t dy, int32_t dx); 116 116 void push_onto_list(Cell *object, Cell *&list); 117 117 -
abuse/trunk/src/lisp.cpp
r39 r43 677 677 } 678 678 679 long lisp_cos(longx)679 int32_t lisp_cos(int32_t x) 680 680 { 681 681 x=(x+FIXED_TRIG_SIZE/4)%FIXED_TRIG_SIZE; … … 684 684 } 685 685 686 long lisp_sin(longx)686 int32_t lisp_sin(int32_t x) 687 687 { 688 688 x=x%FIXED_TRIG_SIZE; … … 691 691 } 692 692 693 long lisp_atan2(long dy, longdx)693 int32_t lisp_atan2(int32_t dy, int32_t dx) 694 694 { 695 695 if (dy==0) … … 709 709 if (abs(dx)>abs(dy)) 710 710 { 711 longa=dx*29/dy;711 int32_t a=dx*29/dy; 712 712 if (a>=TBS) return 0; 713 713 else return 45-atan_table[a]; … … 715 715 else 716 716 { 717 longa=dy*29/dx;717 int32_t a=dy*29/dx; 718 718 if (a>=TBS) return 90; 719 719 else return 45+atan_table[a]; … … 723 723 if (abs(dx)>abs(dy)) 724 724 { 725 longa=dx*29/abs(dy);725 int32_t a=dx*29/abs(dy); 726 726 if (a>=TBS) 727 727 return 0; … … 731 731 else 732 732 { 733 longa=abs(dy)*29/dx;733 int32_t a=abs(dy)*29/dx; 734 734 if (a>=TBS) 735 735 return 260; … … 744 744 if (abs(dx)>abs(dy)) 745 745 { 746 longa=-dx*29/dy;746 int32_t a=-dx*29/dy; 747 747 if (a>=TBS) 748 748 return 135+45; … … 752 752 else 753 753 { 754 longa=dy*29/-dx;754 int32_t a=dy*29/-dx; 755 755 if (a>=TBS) 756 756 return 135-45; … … 762 762 if (abs(dx)>abs(dy)) 763 763 { 764 longa=-dx*29/abs(dy);764 int32_t a=-dx*29/abs(dy); 765 765 if (a>=TBS) 766 766 return 225-45; … … 769 769 else 770 770 { 771 longa=abs(dy)*29/abs(dx);771 int32_t a=abs(dy)*29/abs(dx); 772 772 if (a>=TBS) 773 773 return 225+45; -
abuse/trunk/src/trig.cpp
r2 r43 1 long sin_table[360]={ 1 #include "system.h" 2 3 int32_t sin_table[360]={ 2 4 0x00000000, 0x00000477, 0x000008ef, 0x00000d65, 0x000011db, 0x0000164f, 3 5 0x00001ac2, 0x00001f32, 0x000023a0, 0x0000280c, 0x00002c74, 0x000030d8, … … 61 63 0xffffe53e, 0xffffe9b1, 0xffffee25, 0xfffff29b, 0xfffff711, 0xfffffb89 62 64 }; 63 u nsigned short atan_table[1662]={65 uint16_t atan_table[1662]={ 64 66 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65 67 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Note: See TracChangeset
for help on using the changeset viewer.