Changeset 485 for trunk/thune/math.c
- Timestamp:
- 10/14/07 05:15:23 (13 months ago)
- Files:
-
- 1 modified
-
trunk/thune/math.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/thune/math.c
r482 r485 37 37 38 38 39 #define MJ_INT_INT 0 40 #define MJ_INT_DEC 1 41 #define MJ_DEC_INT 2 42 #define MJ_DEC_DEC 3 43 #define MJ_VEC3_DEC 4 44 #define MJ_DEC_VEC3 5 45 #define MJ_VEC3_VEC3 6 46 #define MJ_INT_BIG 7 47 #define MJ_BIG_INT 8 48 #define MJ_DEC_BIG 9 49 #define MJ_BIG_DEC 10 50 #define MJ_BIG_BIG 11 51 #define MJ_NAN 12 39 enum MathJumpPair 40 { 41 MJ_INT_INT, 42 MJ_INT_DEC, 43 MJ_DEC_INT, 44 MJ_DEC_DEC, 45 MJ_VEC3_DEC, 46 MJ_DEC_VEC3, 47 MJ_VEC3_VEC3, 48 MJ_COORD_INT, 49 MJ_COORD_COORD, 50 MJ_INT_BIG, 51 MJ_BIG_INT, 52 MJ_DEC_BIG, 53 MJ_BIG_DEC, 54 MJ_BIG_BIG, 55 MJ_NAN 56 }; 52 57 53 58 static int _mathJumpIndex( const UCell* a, const UCell* b ) … … 88 93 if( ur_is(b, UT_BIGNUM) ) 89 94 return MJ_BIG_BIG; 95 } 96 else if( ur_is(a, UT_COORD) ) 97 { 98 if( ur_is(b, UT_INT) ) 99 return MJ_COORD_INT; 100 if( ur_is(b, UT_COORD) ) 101 return MJ_COORD_COORD; 90 102 } 91 103 … … 215 227 res->vec3.xyz[1] = res->vec3.xyz[1] OP tos->vec3.xyz[1]; \ 216 228 res->vec3.xyz[2] = res->vec3.xyz[2] OP tos->vec3.xyz[2]; \ 217 break; 229 break; \ 230 case MJ_COORD_INT: \ 231 { int i, count = res->coord.len; \ 232 for( i = 0; i < count; ++i ) \ 233 res->coord.elem[i] = res->coord.elem[i] OP ur_int(tos); \ 234 } break; \ 235 case MJ_COORD_COORD: \ 236 { int i, count = res->coord.len; \ 237 if( tos->coord.len < count ) \ 238 count = tos->coord.len; \ 239 for( i = 0; i < count; ++i ) \ 240 res->coord.elem[i] = res->coord.elem[i] OP tos->coord.elem[i];\ 241 } break; 242 218 243 219 244 #define MATH_OPERATION_END \
