32#ifndef SC_SIGNED_OPS_H
33#define SC_SIGNED_OPS_H
37#define OPS_MIN(A,B) ( (A) <= (B) ? A : B )
38#define OPS_MAX(A,B) ( (A) >= (B) ? A : B )
50#define ADD_BIG_BIG(RESULT_TYPE,LEFT_TYPE,RIGHT_TYPE) \
53 operator+(const LEFT_TYPE& left, const RIGHT_TYPE& right) \
55 const int left_n = left.get_actual_length(); \
56 const int right_n = right.get_actual_length(); \
58 if ( left_n >= right_n ) { \
59 RESULT_TYPE result(left_n+1, false); \
60 vector_add( left.get_hod(), \
65 result.get_digits() ); \
69 RESULT_TYPE result(right_n+1, false); \
70 vector_add( right.get_hod(), \
75 result.get_digits() ); \
80#define ADD_BIG_NATIVE(RESULT_TYPE,BIG_TYPE,NATIVE_TYPE) \
83 operator+(const BIG_TYPE &left, NATIVE_TYPE native) \
85 ScNativeDigits<NATIVE_TYPE> right( native ); \
86 const int left_n = left.get_actual_length(); \
87 const int right_n = right.get_actual_length(); \
89 if ( left_n > right_n ) { \
90 RESULT_TYPE result( left_n+1, false ); \
91 vector_add( left.get_hod(), \
96 result.get_digits() ); \
100 RESULT_TYPE result( right_n+1, false ); \
101 vector_add( right.get_hod(), \
102 right.get_digits(), \
106 result.get_digits() ); \
111#define ADD_NATIVE_BIG(RESULT_TYPE,NATIVE_TYPE,BIG_TYPE) \
114 operator+(NATIVE_TYPE native, const BIG_TYPE &right) \
117 ScNativeDigits<NATIVE_TYPE> left(native); \
118 const int left_n = left.get_actual_length(); \
119 const int right_n = right.get_actual_length(); \
121 if ( left_n > right_n ) { \
122 RESULT_TYPE result( left_n+1, false ); \
123 vector_add( left.get_hod(), \
126 right.get_digits(), \
128 result.get_digits() ); \
132 RESULT_TYPE result( right_n+1, false ); \
135 right.get_digits(), \
139 result.get_digits() ); \
241#define DIVIDE_BIG_BIG(RESULT_TYPE,LEFT_TYPE,RIGHT_TYPE) \
244operator/(const LEFT_TYPE& left, const RIGHT_TYPE& right) \
246 int left_n = left.get_actual_length(); \
248 RESULT_TYPE quotient(left_n+right.SIGNED); \
249 bool ok = vector_divide<LEFT_TYPE::SIGNED,RIGHT_TYPE::SIGNED>( \
250 left.get_digits_n(), \
252 right.get_digits_n(), \
253 right.get_digits(), \
254 quotient.get_digits_n(), \
255 quotient.get_digits(), \
259 SC_REPORT_ERROR( sc_core::SC_ID_OPERATION_FAILED_, \
260 "division by zero detected" ); \
265#define DIVIDE_BIG_NATIVE(RESULT_TYPE,BIG_TYPE,NATIVE_TYPE) \
268 operator/(const BIG_TYPE &left, NATIVE_TYPE native) \
270 ScNativeDigits<NATIVE_TYPE> right( native ); \
271 const int left_n = left.get_actual_length(); \
273 RESULT_TYPE quotient(left_n+right.SIGNED, false); \
275 vector_divide<BIG_TYPE::SIGNED,ScNativeDigits<NATIVE_TYPE>::SIGNED>( \
276 left.get_digits_n(), \
278 right.get_digits_n(), \
279 right.get_digits(), \
280 quotient.get_digits_n(), \
281 quotient.get_digits(), \
285 SC_REPORT_ERROR( sc_core::SC_ID_OPERATION_FAILED_, \
286 "division by zero detected" ); \
291#define DIVIDE_NATIVE_BIG(RESULT_TYPE,NATIVE_TYPE,BIG_TYPE) \
294 operator/(NATIVE_TYPE native, const BIG_TYPE &right) \
297 ScNativeDigits<NATIVE_TYPE> left(native); \
298 const int left_n = left.get_actual_length(); \
300 RESULT_TYPE quotient(left_n+right.SIGNED, false); \
302 vector_divide<ScNativeDigits<NATIVE_TYPE>::SIGNED,BIG_TYPE::SIGNED>( \
303 left.get_digits_n(), \
305 right.get_digits_n(), \
306 right.get_digits(), \
307 quotient.get_digits_n(), \
308 quotient.get_digits(), \
312 SC_REPORT_ERROR( sc_core::SC_ID_OPERATION_FAILED_, \
313 "division by zero detected" ); \
402#undef DIVIDE_BIG_NATIVE
403#undef DIVIDE_NATIVE_BIG
415#define MODULO_BIG_BIG(RESULT_TYPE,LEFT_TYPE,RIGHT_TYPE) \
418operator%(const LEFT_TYPE& left, const RIGHT_TYPE& right) \
420 const int left_n = left.get_actual_length(); \
421 const int right_n = right.get_actual_length(); \
422 const int width_n = OPS_MIN( left_n,right_n+right.SIGNED ); \
424 RESULT_TYPE result(width_n); \
425 vector_divide<LEFT_TYPE::SIGNED,RIGHT_TYPE::SIGNED>( \
426 left.get_digits_n(), \
428 right.get_digits_n(), \
429 right.get_digits(), \
432 result.get_digits_n(), \
433 result.get_digits() ); \
437#define MODULO_BIG_NATIVE(RESULT_TYPE,BIG_TYPE,NATIVE_TYPE) \
440 operator%(const BIG_TYPE &left, NATIVE_TYPE native) \
442 ScNativeDigits<NATIVE_TYPE> right( native ); \
443 const int left_n = left.get_actual_length(); \
444 const int right_n = right.get_actual_length(); \
445 const int width_n = OPS_MIN( left_n,right_n+right.SIGNED ); \
447 RESULT_TYPE result(width_n); \
448 vector_divide<BIG_TYPE::SIGNED,ScNativeDigits<NATIVE_TYPE>::SIGNED>(\
449 left.get_digits_n(), \
451 right.get_digits_n(), \
452 right.get_digits(), \
455 result.get_digits_n(), \
456 result.get_digits() ); \
460#define MODULO_NATIVE_BIG(RESULT_TYPE,NATIVE_TYPE,BIG_TYPE) \
463 operator%(NATIVE_TYPE native, const BIG_TYPE &right) \
466 ScNativeDigits<NATIVE_TYPE> left(native); \
467 const int left_n = left.get_actual_length(); \
468 const int right_n = right.get_actual_length(); \
469 const int width_n = OPS_MIN( left_n,right_n+right.SIGNED ); \
471 RESULT_TYPE result(width_n); \
472 vector_divide<ScNativeDigits<NATIVE_TYPE>::SIGNED,BIG_TYPE::SIGNED>(\
473 left.get_digits_n(), \
475 right.get_digits_n(), \
476 right.get_digits(), \
479 result.get_digits_n(), \
480 result.get_digits() ); \
568#undef MODULO_BIG_NATIVE
569#undef MODULO_NATIVE_BIG
582#define MULTIPLY_BIG_BIG(RESULT_TYPE,LEFT_TYPE,RIGHT_TYPE) \
585operator*(const LEFT_TYPE& left, const RIGHT_TYPE& right) \
587 int left_n = left.get_actual_length(); \
588 int right_n = right.get_actual_length(); \
590 RESULT_TYPE result(left_n+right_n, false); \
591 vector_multiply( left.get_hod(), \
594 right.get_digits(), \
596 result.get_digits() ); \
600#define MULTIPLY_BIG_NATIVE(RESULT_TYPE,BIG_TYPE,NATIVE_TYPE) \
603 operator*(const BIG_TYPE &left, NATIVE_TYPE native) \
605 ScNativeDigits<NATIVE_TYPE> right( native ); \
606 const int left_n = left.get_actual_length(); \
607 const int right_n = right.get_actual_length(); \
609 RESULT_TYPE result(left_n+right_n, false); \
610 vector_multiply( left.get_hod(), \
613 right.get_digits(), \
615 result.get_digits() ); \
619#define MULTIPLY_NATIVE_BIG(RESULT_TYPE,NATIVE_TYPE,BIG_TYPE) \
622 operator*(NATIVE_TYPE native, const BIG_TYPE &right) \
625 ScNativeDigits<NATIVE_TYPE> left(native); \
626 const int left_n = left.get_actual_length(); \
627 const int right_n = right.get_actual_length(); \
629 RESULT_TYPE result(left_n+right_n, false); \
630 vector_multiply( left.get_hod(), \
633 right.get_digits(), \
635 result.get_digits() ); \
722#undef MULTIPLY_BIG_BIG
723#undef MULTIPLY_BIG_NATIVE
724#undef MULTIPLY_NATIVE_BIG
736#define SUBTRACT_BIG_BIG(LEFT_TYPE,RIGHT_TYPE) \
739operator-(const LEFT_TYPE& left, const RIGHT_TYPE& right) \
741 int left_n = left.get_actual_length(); \
742 int right_n = right.get_actual_length(); \
744 if ( left_n >= right_n ) { \
745 sc_signed result(left_n+1, false); \
746 vector_subtract_shorter( left.get_hod(), \
749 right.get_digits(), \
751 result.get_digits() ); \
755 sc_signed result(right_n+1, false); \
756 vector_subtract_longer( right.get_hod(), \
757 right.get_digits(), \
761 result.get_digits() ); \
766#define SUBTRACT_BIG_NATIVE(BIG_TYPE,NATIVE_TYPE) \
769 operator-(const BIG_TYPE &left, NATIVE_TYPE native) \
771 ScNativeDigits<NATIVE_TYPE> right( native ); \
772 const int left_n = left.get_actual_length(); \
773 const int right_n = right.get_actual_length(); \
775 if ( left_n > right_n ) { \
776 sc_signed result( left_n+1, false ); \
777 vector_subtract_shorter( left.get_hod(), \
780 right.get_digits(), \
782 result.get_digits() ); \
786 sc_signed result( right_n+1, false ); \
787 vector_subtract_longer( right.get_hod(), \
788 right.get_digits(), \
792 result.get_digits() ); \
797#define SUBTRACT_NATIVE_BIG(NATIVE_TYPE,BIG_TYPE) \
800 operator-(NATIVE_TYPE native, const BIG_TYPE &right) \
803 ScNativeDigits<NATIVE_TYPE> left(native); \
804 const int left_n = left.get_actual_length(); \
805 const int right_n = right.get_actual_length(); \
807 if ( left_n > right_n ) { \
808 sc_signed result( left_n+1, false ); \
809 vector_subtract_shorter( left.get_hod(), \
812 right.get_digits(), \
814 result.get_digits() ); \
818 sc_signed result( right_n+1, false ); \
819 vector_subtract_longer( \
821 right.get_digits(), \
825 result.get_digits() ); \
907#undef SUBTRACT_BIG_BIG
908#undef SUBTRACT_BIG_NATIVE
909#undef SUBTRACT_NATIVE_BIG
921#define BIT_OP_BIG_BIG(OP,BIT_OP_RTN,RESULT_TYPE,LEFT_TYPE,RIGHT_TYPE) \
924operator OP (const LEFT_TYPE& left, const RIGHT_TYPE& right) \
928 if ( RESULT_TYPE::SIGNED ) { \
929 left_n = left.get_actual_length(); \
930 right_n = right.get_actual_length(); \
933 left_n = left.length(); \
934 right_n = right.length(); \
937 if ( left_n >= right_n ) { \
938 RESULT_TYPE result(left_n, false); \
939 BIT_OP_RTN<LEFT_TYPE::SIGNED,RIGHT_TYPE::SIGNED>( \
943 right.get_digits(), \
944 result.get_digits() ); \
945 result.adjust_hod(); \
949 RESULT_TYPE result(right_n, false); \
950 BIT_OP_RTN<RIGHT_TYPE::SIGNED,LEFT_TYPE::SIGNED>( \
952 right.get_digits(), \
955 result.get_digits() ); \
956 result.adjust_hod(); \
961#define BIT_OP_BIG_NATIVE(OP,BIT_OP_RTN,RESULT_TYPE,BIG_TYPE,NATIVE_TYPE) \
964 operator OP (const BIG_TYPE &left, NATIVE_TYPE native) \
967 ScNativeDigits<NATIVE_TYPE> right( native ); \
969 if ( RESULT_TYPE::SIGNED ) { \
970 left_n = left.get_actual_length(); \
971 right_n = right.get_actual_length(); \
974 left_n = left.length(); \
975 right_n = right.length(); \
978 if ( left_n > right_n ) { \
979 RESULT_TYPE result( left_n, false ); \
980 BIT_OP_RTN<BIG_TYPE::SIGNED,ScNativeDigits<NATIVE_TYPE>::SIGNED>( \
981 result.get_hod() < left.get_hod() ? result.get_hod() : left.get_hod(), \
983 result.get_hod() < right.get_hod() ? result.get_hod() : right.get_hod(), \
984 right.get_digits(), \
985 result.get_digits() ); \
986 result.adjust_hod(); \
990 RESULT_TYPE result( right_n, false ); \
991 BIT_OP_RTN<ScNativeDigits<NATIVE_TYPE>::SIGNED,BIG_TYPE::SIGNED>( \
992 result.get_hod() < right.get_hod() ? result.get_hod() : right.get_hod(), \
993 right.get_digits(), \
994 result.get_hod() < left.get_hod() ? result.get_hod() : left.get_hod(), \
996 result.get_digits() ); \
997 result.adjust_hod(); \
1002#define BIT_OP_NATIVE_BIG(OP,BIT_OP_RTN,RESULT_TYPE,NATIVE_TYPE,BIG_TYPE) \
1005 operator OP (NATIVE_TYPE native, const BIG_TYPE &right) \
1008 ScNativeDigits<NATIVE_TYPE> left(native); \
1011 if ( RESULT_TYPE::SIGNED ) { \
1012 left_n = left.get_actual_length(); \
1013 right_n = right.get_actual_length(); \
1016 left_n = left.length(); \
1017 right_n = right.length(); \
1020 if ( left_n > right_n ) { \
1021 RESULT_TYPE result( left_n, false ); \
1022 BIT_OP_RTN<ScNativeDigits<NATIVE_TYPE>::SIGNED,BIG_TYPE::SIGNED>( \
1023 result.get_hod() < left.get_hod() ? result.get_hod() : left.get_hod(), \
1024 left.get_digits(), \
1025 result.get_hod() < right.get_hod() ? result.get_hod() : right.get_hod(), \
1026 right.get_digits(), \
1027 result.get_digits() ); \
1028 result.adjust_hod(); \
1032 RESULT_TYPE result( right_n, false ); \
1033 BIT_OP_RTN<BIG_TYPE::SIGNED,ScNativeDigits<NATIVE_TYPE>::SIGNED>( \
1034 result.get_hod() < right.get_hod() ? result.get_hod() : right.get_hod(), \
1035 right.get_digits(), \
1036 result.get_hod() < left.get_hod() ? result.get_hod() : left.get_hod(), \
1037 left.get_digits(), \
1038 result.get_digits() ); \
1039 result.adjust_hod(); \
1044#define BIT_OPS_BIG(OPER,BIT_OP_RTN) \
1048BIT_OP_BIG_BIG(OPER,BIT_OP_RTN,sc_signed,sc_signed,sc_signed) \
1049BIT_OP_BIG_BIG(OPER,BIT_OP_RTN,sc_signed,sc_unsigned,sc_signed) \
1050BIT_OP_BIG_BIG(OPER,BIT_OP_RTN,sc_signed,sc_signed,sc_unsigned) \
1051BIT_OP_BIG_BIG(OPER,BIT_OP_RTN,sc_unsigned,sc_unsigned,sc_unsigned) \
1055BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_signed,sc_signed,int64) \
1056BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_signed,sc_signed,uint64) \
1057BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_signed,sc_signed,long) \
1058BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_signed,sc_signed,unsigned long) \
1059BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_signed,sc_signed,int) \
1060BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_signed,sc_signed,unsigned int) \
1064BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_signed,int64,sc_signed) \
1065BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_signed,uint64,sc_signed) \
1066BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_signed,long,sc_signed) \
1067BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_signed,unsigned long,sc_signed) \
1068BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_signed,int,sc_signed) \
1069BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_signed,unsigned int,sc_signed) \
1073BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_signed,sc_unsigned,int64) \
1074BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_signed,sc_unsigned,long) \
1075BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_signed,sc_unsigned,int) \
1079BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_signed,int64,sc_unsigned) \
1080BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_signed,long,sc_unsigned) \
1081BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_signed,int,sc_unsigned) \
1085BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_unsigned,sc_unsigned,uint64) \
1086BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_unsigned,sc_unsigned,unsigned long) \
1087BIT_OP_BIG_NATIVE(OPER,BIT_OP_RTN,sc_unsigned,sc_unsigned,unsigned int) \
1091BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_unsigned,uint64,sc_unsigned) \
1092BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_unsigned,unsigned long,sc_unsigned) \
1093BIT_OP_NATIVE_BIG(OPER,BIT_OP_RTN,sc_unsigned,unsigned int,sc_unsigned)
1205#undef BIT_OP_BIG_BIG
1206#undef BIT_OP_BIG_NATIVE
1207#undef BIT_OP_NATIVE_BIG
1266#define COMPARE_BIG_BIG(OP,LEFT_TYPE,RIGHT_TYPE) \
1269 operator OP(const LEFT_TYPE& left, const RIGHT_TYPE& right) \
1272 return vector_compare<LEFT_TYPE::SIGNED,RIGHT_TYPE::SIGNED>( \
1274 left.get_digits(), \
1276 right.get_digits() ) OP 0; \
1279#define COMPARE_BIG_NATIVE(OP,BIG_TYPE,NATIVE_TYPE) \
1282 operator OP(const BIG_TYPE &left, NATIVE_TYPE native) \
1284 ScNativeDigits<NATIVE_TYPE> right( native ); \
1287 vector_compare<BIG_TYPE::SIGNED,ScNativeDigits<NATIVE_TYPE>::SIGNED>( \
1289 left.get_digits(), \
1291 right.get_digits() ) OP 0; \
1294#define COMPARE_NATIVE_BIG(OP,NATIVE_TYPE,BIG_TYPE) \
1297 operator OP(NATIVE_TYPE native, const BIG_TYPE &right) \
1300 ScNativeDigits<NATIVE_TYPE> left(native); \
1303 vector_compare<ScNativeDigits<NATIVE_TYPE>::SIGNED,BIG_TYPE::SIGNED>( \
1305 left.get_digits(), \
1307 right.get_digits() ) OP 0; \
1310#define COMPARE_BIG_OPS(OP) \
1314 COMPARE_BIG_BIG(OP,sc_signed,sc_signed) \
1315 COMPARE_BIG_BIG(OP,sc_unsigned,sc_signed) \
1316 COMPARE_BIG_BIG(OP,sc_signed,sc_unsigned) \
1317 COMPARE_BIG_BIG(OP,sc_unsigned,sc_unsigned) \
1321 COMPARE_BIG_NATIVE(OP,sc_signed,int64) \
1322 COMPARE_BIG_NATIVE(OP,sc_signed,uint64) \
1323 COMPARE_BIG_NATIVE(OP,sc_signed,long) \
1324 COMPARE_BIG_NATIVE(OP,sc_signed,unsigned long) \
1325 COMPARE_BIG_NATIVE(OP,sc_signed,int) \
1326 COMPARE_BIG_NATIVE(OP,sc_signed,unsigned int) \
1330 COMPARE_NATIVE_BIG(OP,int64,sc_signed) \
1331 COMPARE_NATIVE_BIG(OP,uint64,sc_signed) \
1332 COMPARE_NATIVE_BIG(OP,long,sc_signed) \
1333 COMPARE_NATIVE_BIG(OP,unsigned long,sc_signed) \
1334 COMPARE_NATIVE_BIG(OP,int,sc_signed) \
1335 COMPARE_NATIVE_BIG(OP,unsigned int,sc_signed) \
1339 COMPARE_BIG_NATIVE(OP,sc_unsigned,int64) \
1340 COMPARE_BIG_NATIVE(OP,sc_unsigned,long) \
1341 COMPARE_BIG_NATIVE(OP,sc_unsigned,int) \
1345 COMPARE_NATIVE_BIG(OP,int64,sc_unsigned) \
1346 COMPARE_NATIVE_BIG(OP,long,sc_unsigned) \
1347 COMPARE_NATIVE_BIG(OP,int,sc_unsigned) \
1351 COMPARE_BIG_NATIVE(OP,sc_unsigned,uint64) \
1352 COMPARE_BIG_NATIVE(OP,sc_unsigned,unsigned long) \
1353 COMPARE_BIG_NATIVE(OP,sc_unsigned,unsigned int) \
1357 COMPARE_NATIVE_BIG(OP,uint64,sc_unsigned) \
1358 COMPARE_NATIVE_BIG(OP,unsigned long,sc_unsigned) \
1359 COMPARE_NATIVE_BIG(OP,unsigned int,sc_unsigned) \
1364 bool operator OP( const sc_signed& left, const sc_int_base& right ) \
1365 { return (left OP (int64)right); } \
1368 bool operator OP( const sc_signed& left, const sc_uint_base& right ) \
1369 { return (left OP (uint64)right); } \
1372 bool operator OP( const sc_int_base& left, const sc_signed& right ) \
1373 { return ((int64)left OP right); } \
1376 bool operator OP( const sc_uint_base& left, const sc_signed& right ) \
1377 { return ((uint64)left OP right); } \
1380 bool operator OP( const sc_unsigned& left, const sc_int_base& right ) \
1381 { return (left OP (int64)right); } \
1384 bool operator OP( const sc_int_base& left, const sc_unsigned& right ) \
1385 { return ((int64)left OP right); } \
1388 bool operator OP(const sc_unsigned& left, const sc_uint_base& right ) \
1389 { return (left OP (uint64)right); } \
1392 bool operator OP(const sc_uint_base& left, const sc_unsigned& right ) \
1393 { return ((uint64)left OP right); }
1402#undef COMPARE_BIG_BIG
1403#undef COMPARE_BIG_NATIVE
1404#undef COMPARE_NATIVE_BIG
1405#undef COMPARE_BIG_OPS
1464#define BIG_OP_EQUALS(OPEQ,OP,BASE_TYPE,OTHER_TYPE) \
1467BASE_TYPE::operator OPEQ (OTHER_TYPE right) \
1469 *this = *this OP right; \
1473#define BIG_OPS_EQUALS(OPEQ,OP) \
1474 BIG_OP_EQUALS(OPEQ,OP,sc_signed,const sc_signed&) \
1475 BIG_OP_EQUALS(OPEQ,OP,sc_signed,const sc_unsigned&) \
1476 BIG_OP_EQUALS(OPEQ,OP,sc_signed,int64) \
1477 BIG_OP_EQUALS(OPEQ,OP,sc_signed,long) \
1478 BIG_OP_EQUALS(OPEQ,OP,sc_signed,int) \
1479 BIG_OP_EQUALS(OPEQ,OP,sc_signed,uint64) \
1480 BIG_OP_EQUALS(OPEQ,OP,sc_signed,unsigned long) \
1481 BIG_OP_EQUALS(OPEQ,OP,sc_signed,unsigned int) \
1482 BIG_OP_EQUALS(OPEQ,OP,sc_unsigned,const sc_signed&) \
1483 BIG_OP_EQUALS(OPEQ,OP,sc_unsigned,const sc_unsigned&) \
1484 BIG_OP_EQUALS(OPEQ,OP,sc_unsigned,int64) \
1485 BIG_OP_EQUALS(OPEQ,OP,sc_unsigned,long) \
1486 BIG_OP_EQUALS(OPEQ,OP,sc_unsigned,int) \
1487 BIG_OP_EQUALS(OPEQ,OP,sc_unsigned,uint64) \
1488 BIG_OP_EQUALS(OPEQ,OP,sc_unsigned,unsigned long) \
1489 BIG_OP_EQUALS(OPEQ,OP,sc_unsigned,unsigned int) \
1490 inline sc_signed& sc_signed::operator OPEQ (const sc_int_base& right) \
1491 { return *this OPEQ (int64)right; } \
1492 inline sc_signed& sc_signed::operator OPEQ (const sc_uint_base& right) \
1493 { return *this OPEQ (uint64)right; } \
1494 inline sc_unsigned& sc_unsigned::operator OPEQ (const sc_int_base& right) \
1495 { return *this OPEQ (int64)right; } \
1496 inline sc_unsigned& sc_unsigned::operator OPEQ (const sc_uint_base& right) \
1497 { return *this OPEQ (uint64)right; }
1525 sc_digit* source_p = u.get_digits();
1526 int hod = u.get_hod();
1527 for (
int digit_i = 0; digit_i <= hod; ++digit_i ) {
1528 result_p[digit_i] = ~source_p[digit_i];
1541 for (
int digit_i = 0; digit_i <= hod; ++digit_i ) {
1542 result_p[digit_i] = ~source_p[digit_i];
1544 if ( result.
get_hod() > hod ) {
#define BIG_OPS_EQUALS(OPEQ, OP)
#define SUBTRACT_NATIVE_BIG(NATIVE_TYPE, BIG_TYPE)
#define DIVIDE_NATIVE_BIG(RESULT_TYPE, NATIVE_TYPE, BIG_TYPE)
#define DIVIDE_BIG_BIG(RESULT_TYPE, LEFT_TYPE, RIGHT_TYPE)
#define ADD_NATIVE_BIG(RESULT_TYPE, NATIVE_TYPE, BIG_TYPE)
#define COMPARE_BIG_OPS(OP)
#define SUBTRACT_BIG_NATIVE(BIG_TYPE, NATIVE_TYPE)
#define SUBTRACT_BIG_BIG(LEFT_TYPE, RIGHT_TYPE)
#define MULTIPLY_BIG_NATIVE(RESULT_TYPE, BIG_TYPE, NATIVE_TYPE)
#define MODULO_NATIVE_BIG(RESULT_TYPE, NATIVE_TYPE, BIG_TYPE)
#define MULTIPLY_BIG_BIG(RESULT_TYPE, LEFT_TYPE, RIGHT_TYPE)
#define MODULO_BIG_NATIVE(RESULT_TYPE, BIG_TYPE, NATIVE_TYPE)
#define MODULO_BIG_BIG(RESULT_TYPE, LEFT_TYPE, RIGHT_TYPE)
#define MULTIPLY_NATIVE_BIG(RESULT_TYPE, NATIVE_TYPE, BIG_TYPE)
#define DIVIDE_BIG_NATIVE(RESULT_TYPE, BIG_TYPE, NATIVE_TYPE)
#define BIT_OPS_BIG(OPER, BIT_OP_RTN)
#define ADD_BIG_BIG(RESULT_TYPE, LEFT_TYPE, RIGHT_TYPE)
#define ADD_BIG_NATIVE(RESULT_TYPE, BIG_TYPE, NATIVE_TYPE)
sc_bit operator&(const sc_bit &a, const sc_bit &b)
void vector_xor(const int longer_hod, const sc_digit *longer_p, const int shorter_hod, const sc_digit *shorter_p, sc_digit *result_p)
sc_bit operator^(const sc_bit &a, const sc_bit &b)
const sc_big_op_info< WL, true, WR, true >::add_result operator+(const sc_bigint< WL > &left, const sc_bigint< WR > &right)
sc_fxval operator/(const sc_fxnum &a, const sc_fxnum &b)
unsigned long long uint64
void vector_or(const int longer_hod, const sc_digit *longer_p, const int shorter_hod, const sc_digit *shorter_p, sc_digit *result_p)
const sc_big_op_info< WL, true, WR, true >::mod_result operator%(const sc_bigint< WL > &numer, const sc_bigint< WR > &denom)
const sc_big_op_info< WL, true, WR, true >::sub_result operator-(const sc_bigint< WL > &left, const sc_bigint< WR > &right)
const sc_big_op_info< WL, true, WR, true >::mul_result operator*(const sc_bigint< WL > &left, const sc_bigint< WR > &right)
void vector_and(const int longer_hod, const sc_digit *longer_p, const int shorter_hod, const sc_digit *shorter_p, sc_digit *result_p)
sc_bit operator~(const sc_bit &a)
sc_bit operator|(const sc_bit &a, const sc_bit &b)
sc_digit * get_digits() const
sc_digit * get_digits() const
sc_unsigned & operator++()
sc_unsigned & operator--()