Changeset 54 for trunk/orca/op.c
- Timestamp:
- 02/17/06 15:30:01 (3 years ago)
- Files:
-
- 1 modified
-
trunk/orca/op.c (modified) (39 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/orca/op.c
r51 r54 35 35 if( orIs(b, OT_INTEGER) ) 36 36 { 37 orResult( OT_INTEGER, a->integer + b->integer);38 return; 39 } 40 else if( orIs(b, OT_DECIMAL) ) 41 { 42 orResultDECIMAL( (double) a->integer + b->num.decimal);37 orResult( OT_INTEGER, orInt(a) + orInt(b) ); 38 return; 39 } 40 else if( orIs(b, OT_DECIMAL) ) 41 { 42 orResultDECIMAL( (double) orInt(a) + orDecimal(b) ); 43 43 return; 44 44 } … … 52 52 for( i = 0; i < res->argc; i++ ) 53 53 { 54 tmp = a->integer+ b->tuple[i];54 tmp = orInt(a) + b->tuple[i]; 55 55 res->tuple[i] = orToByteRange(tmp); 56 56 } … … 65 65 if( orIs(b, OT_INTEGER) ) 66 66 { 67 orResultDECIMAL( a->num.decimal + (double) b->integer);68 return; 69 } 70 else if( orIs(b, OT_DECIMAL) ) 71 { 72 orResultDECIMAL( a->num.decimal + b->num.decimal);67 orResultDECIMAL( orDecimal(a) + (double) orInt(b) ); 68 return; 69 } 70 else if( orIs(b, OT_DECIMAL) ) 71 { 72 orResultDECIMAL( orDecimal(a) + orDecimal(b) ); 73 73 return; 74 74 } … … 82 82 for( i = 0; i < res->argc; i++ ) 83 83 { 84 tmp = (int) a->num.decimal+ b->tuple[i];84 tmp = (int) orDecimal(a) + b->tuple[i]; 85 85 res->tuple[i] = orToByteRange(tmp); 86 86 } … … 117 117 for( i = 0; i < res->argc; i++ ) 118 118 { 119 tmp = a->tuple[i] + b->integer;119 tmp = a->tuple[i] + orInt(b); 120 120 res->tuple[i] = orToByteRange(tmp); 121 121 } … … 131 131 for( i = 0; i < res->argc; i++ ) 132 132 { 133 tmp = a->tuple[i] + (int) b->num.decimal;133 tmp = a->tuple[i] + (int) orDecimal(b); 134 134 res->tuple[i] = orToByteRange(tmp); 135 135 } … … 170 170 if( orIs(b, OT_INTEGER) ) 171 171 { 172 orResult( OT_INTEGER, a->integer - b->integer);173 return; 174 } 175 else if( orIs(b, OT_DECIMAL) ) 176 { 177 orResultDECIMAL( (double) a->integer - b->num.decimal);172 orResult( OT_INTEGER, orInt(a) - orInt(b) ); 173 return; 174 } 175 else if( orIs(b, OT_DECIMAL) ) 176 { 177 orResultDECIMAL( (double) orInt(a) - orDecimal(b) ); 178 178 return; 179 179 } … … 185 185 if( orIs(b, OT_INTEGER) ) 186 186 { 187 orResultDECIMAL( a->num.decimal - (double) b->integer);188 return; 189 } 190 else if( orIs(b, OT_DECIMAL) ) 191 { 192 orResultDECIMAL( a->num.decimal - b->num.decimal);187 orResultDECIMAL( orDecimal(a) - (double) orInt(b) ); 188 return; 189 } 190 else if( orIs(b, OT_DECIMAL) ) 191 { 192 orResultDECIMAL( orDecimal(a) - orDecimal(b) ); 193 193 return; 194 194 } … … 221 221 for( i = 0; i < res->argc; i++ ) 222 222 { 223 tmp = a->tuple[i] - b->integer;223 tmp = a->tuple[i] - orInt(b); 224 224 res->tuple[i] = orToByteRange(tmp); 225 225 } … … 235 235 for( i = 0; i < res->argc; i++ ) 236 236 { 237 tmp = a->tuple[i] - (int) b->num.decimal;237 tmp = a->tuple[i] - (int) orDecimal(b); 238 238 res->tuple[i] = orToByteRange(tmp); 239 239 } … … 288 288 if( orIs(b, OT_INTEGER) ) 289 289 { 290 orResult( OT_INTEGER, a->integer * b->integer);291 return; 292 } 293 else if( orIs(b, OT_DECIMAL) ) 294 { 295 orResultDECIMAL( (double) a->integer * b->num.decimal);290 orResult( OT_INTEGER, orInt(a) * orInt(b) ); 291 return; 292 } 293 else if( orIs(b, OT_DECIMAL) ) 294 { 295 orResultDECIMAL( (double) orInt(a) * orDecimal(b) ); 296 296 return; 297 297 } … … 305 305 for( i = 0; i < res->argc; i++ ) 306 306 { 307 tmp = a->integer* b->tuple[i];307 tmp = orInt(a) * b->tuple[i]; 308 308 res->tuple[i] = orToByteRange(tmp); 309 309 } … … 318 318 if( orIs(b, OT_INTEGER) ) 319 319 { 320 orResultDECIMAL( a->num.decimal * (double) b->integer);321 return; 322 } 323 else if( orIs(b, OT_DECIMAL) ) 324 { 325 orResultDECIMAL( a->num.decimal * b->num.decimal);320 orResultDECIMAL( orDecimal(a) * (double) orInt(b) ); 321 return; 322 } 323 else if( orIs(b, OT_DECIMAL) ) 324 { 325 orResultDECIMAL( orDecimal(a) * orDecimal(b) ); 326 326 return; 327 327 } … … 335 335 for( i = 0; i < res->argc; i++ ) 336 336 { 337 tmp = a->num.decimal* b->tuple[i];337 tmp = orDecimal(a) * b->tuple[i]; 338 338 res->tuple[i] = orToByteRange(tmp); 339 339 } … … 370 370 for( i = 0; i < res->argc; i++ ) 371 371 { 372 tmp = a->tuple[i] * b->integer;372 tmp = a->tuple[i] * orInt(b); 373 373 res->tuple[i] = orToByteRange(tmp); 374 374 } … … 384 384 for( i = 0; i < res->argc; i++ ) 385 385 { 386 tmp = a->tuple[i] * b->num.decimal;386 tmp = a->tuple[i] * orDecimal(b); 387 387 res->tuple[i] = orToByteRange(tmp); 388 388 } … … 402 402 if( orIs(b, OT_INTEGER) ) 403 403 { 404 if( b->integer== 0 )404 if( orInt(b) == 0 ) 405 405 goto div0; 406 orResult( OT_INTEGER, a->integer / b->integer);407 return; 408 } 409 else if( orIs(b, OT_DECIMAL) ) 410 { 411 if( b->num.decimal== 0.0 )406 orResult( OT_INTEGER, orInt(a) / orInt(b) ); 407 return; 408 } 409 else if( orIs(b, OT_DECIMAL) ) 410 { 411 if( orDecimal(b) == 0.0 ) 412 412 goto div0; 413 orResultDECIMAL( (double) a->integer / b->num.decimal);413 orResultDECIMAL( (double) orInt(a) / orDecimal(b) ); 414 414 return; 415 415 } … … 420 420 if( orIs(b, OT_INTEGER) ) 421 421 { 422 if( b->integer== 0 )422 if( orInt(b) == 0 ) 423 423 goto div0; 424 orResultDECIMAL( a->num.decimal / (double) b->integer);425 return; 426 } 427 else if( orIs(b, OT_DECIMAL) ) 428 { 429 if( b->num.decimal== 0.0 )424 orResultDECIMAL( orDecimal(a) / (double) orInt(b) ); 425 return; 426 } 427 else if( orIs(b, OT_DECIMAL) ) 428 { 429 if( orDecimal(b) == 0.0 ) 430 430 goto div0; 431 orResultDECIMAL( a->num.decimal / b->num.decimal);431 orResultDECIMAL( orDecimal(a) / orDecimal(b) ); 432 432 return; 433 433 } … … 462 462 for( i = 0; i < res->argc; i++ ) 463 463 { 464 if ( b->integer== 0)464 if (orInt(b) == 0) 465 465 goto div0; 466 tmp = a->tuple[i] / b->integer;466 tmp = a->tuple[i] / orInt(b); 467 467 res->tuple[i] = orToByteRange(tmp); 468 468 } … … 478 478 for( i = 0; i < res->argc; i++ ) 479 479 { 480 if ( b->num.decimal== 0)480 if (orDecimal(b) == 0) 481 481 goto div0; 482 tmp = a->tuple[i] / b->num.decimal;482 tmp = a->tuple[i] / orDecimal(b); 483 483 res->tuple[i] = orToByteRange(tmp); 484 484 } … … 722 722 723 723 case OT_DECIMAL: 724 if( a->num.decimal == b->num.decimal)724 if( orDecimal(a) == orDecimal(b) ) 725 725 logic = 1; 726 726 break; … … 729 729 case OT_LOGIC: 730 730 case OT_INTEGER: 731 if( a->integer == b->integer)731 if( orInt(a) == orInt(b) ) 732 732 logic = 1; 733 733 break; … … 750 750 if( orIs(b, OT_INTEGER) ) 751 751 { 752 if( a->integer == b->integer)752 if( orInt(a) == orInt(b) ) 753 753 return 1; 754 754 } 755 755 else if( orIs(b, OT_DECIMAL) ) 756 756 { 757 if( ((double) a->integer) == b->num.decimal)757 if( ((double) orInt(a)) == orDecimal(b) ) 758 758 return 1; 759 759 } … … 764 764 if( orIs(b, OT_INTEGER) ) 765 765 { 766 if( a->num.decimal == ((double) b->integer) )766 if( orDecimal(a) == ((double) orInt(b)) ) 767 767 return 1; 768 768 } 769 769 else if( orIs(b, OT_DECIMAL) ) 770 770 { 771 if( a->num.decimal == b->num.decimal)771 if( orDecimal(a) == orDecimal(b) ) 772 772 return 1; 773 773 } … … 808 808 { 809 809 if( orIs(b, OT_INTEGER) ) 810 logic = ( a->integer == b->integer);811 else if( orIs(b, OT_DECIMAL) ) 812 logic = ((double) a->integer == b->num.decimal);810 logic = (orInt(a) == orInt(b)); 811 else if( orIs(b, OT_DECIMAL) ) 812 logic = ((double) orInt(a) == orDecimal(b)); 813 813 } 814 814 else if( orIs(a, OT_DECIMAL) ) 815 815 { 816 816 if( orIs(b, OT_INTEGER) ) 817 logic = ( a->num.decimal == (double) b->integer);818 else if( orIs(b, OT_DECIMAL) ) 819 logic = ( a->num.decimal == b->num.decimal);817 logic = (orDecimal(a) == (double) orInt(b)); 818 else if( orIs(b, OT_DECIMAL) ) 819 logic = (orDecimal(a) == orDecimal(b)); 820 820 } 821 821 else if( orType(a) == orType(b) ) … … 896 896 if( orIs(b, OT_INTEGER) ) 897 897 { 898 orResult( OT_INTEGER, a->integer & b->integer);898 orResult( OT_INTEGER, orInt(a) & orInt(b) ); 899 899 return; 900 900 } … … 905 905 if( orIs(b, OT_LOGIC) ) 906 906 { 907 orResult( OT_LOGIC, a->integer & b->integer);907 orResult( OT_LOGIC, orInt(a) & orInt(b) ); 908 908 return; 909 909 } … … 933 933 for( i = 0; i < a->argc; i++ ) 934 934 { 935 a->tuple[i] = a->tuple[i] & b->integer;935 a->tuple[i] = a->tuple[i] & orInt(b); 936 936 } 937 937 return; … … 942 942 for( i = 0; i < a->argc; i++ ) 943 943 { 944 a->tuple[i] = a->tuple[i] & (int) b->num.decimal;944 a->tuple[i] = a->tuple[i] & (int) orDecimal(b); 945 945 } 946 946 return; … … 959 959 if( orIs(b, OT_INTEGER) ) 960 960 { 961 orResult( OT_INTEGER, a->integer | b->integer);961 orResult( OT_INTEGER, orInt(a) | orInt(b) ); 962 962 return; 963 963 } … … 968 968 if( orIs(b, OT_LOGIC) ) 969 969 { 970 orResult( OT_LOGIC, a->integer | b->integer);970 orResult( OT_LOGIC, orInt(a) | orInt(b) ); 971 971 return; 972 972 } … … 990 990 for( i = 0; i < a->argc; i++ ) 991 991 { 992 a->tuple[i] = a->tuple[i] | b->integer;992 a->tuple[i] = a->tuple[i] | orInt(b); 993 993 } 994 994 return; … … 999 999 for( i = 0; i < a->argc; i++ ) 1000 1000 { 1001 a->tuple[i] = a->tuple[i] | (int) b->num.decimal;1001 a->tuple[i] = a->tuple[i] | (int) orDecimal(b); 1002 1002 } 1003 1003 return; … … 1016 1016 if( orIs(b, OT_INTEGER) ) 1017 1017 { 1018 orResult( OT_INTEGER, a->integer ^ b->integer);1018 orResult( OT_INTEGER, orInt(a) ^ orInt(b) ); 1019 1019 return; 1020 1020 } … … 1025 1025 if( orIs(b, OT_LOGIC) ) 1026 1026 { 1027 orResult( OT_LOGIC, a->integer ^ b->integer);1027 orResult( OT_LOGIC, orInt(a) ^ orInt(b) ); 1028 1028 return; 1029 1029 } … … 1047 1047 for( i = 0; i < a->argc; i++ ) 1048 1048 { 1049 a->tuple[i] = a->tuple[i] ^ b->integer;1049 a->tuple[i] = a->tuple[i] ^ orInt(b); 1050 1050 } 1051 1051 return; … … 1056 1056 for( i = 0; i < a->argc; i++ ) 1057 1057 { 1058 a->tuple[i] = a->tuple[i] ^ (int) b->num.decimal;1058 a->tuple[i] = a->tuple[i] ^ (int) orDecimal(b); 1059 1059 } 1060 1060 return; … … 1070 1070 int logic = 0; 1071 1071 if( orIs(a1, OT_DECIMAL) ) 1072 logic = ((int) a1->num.decimal) & 1;1072 logic = ((int) orDecimal(a1)) & 1; 1073 1073 else 1074 logic = a1->integer& 1;1074 logic = orInt(a1) & 1; 1075 1075 orResult( OT_LOGIC, logic ); 1076 1076 } … … 1080 1080 { 1081 1081 orOddNative( a1 ); 1082 a1->integer^= 1;1082 orInt(a1) ^= 1; 1083 1083 } 1084 1084
