00001 // $Id: xlong.cpp 1282 2006-06-09 09:46:49Z alex $ 00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE 00003 ================================XARAHEADERSTART=========================== 00004 00005 Xara LX, a vector drawing and manipulation program. 00006 Copyright (C) 1993-2006 Xara Group Ltd. 00007 Copyright on certain contributions may be held in joint with their 00008 respective authors. See AUTHORS file for details. 00009 00010 LICENSE TO USE AND MODIFY SOFTWARE 00011 ---------------------------------- 00012 00013 This file is part of Xara LX. 00014 00015 Xara LX is free software; you can redistribute it and/or modify it 00016 under the terms of the GNU General Public License version 2 as published 00017 by the Free Software Foundation. 00018 00019 Xara LX and its component source files are distributed in the hope 00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the 00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00022 See the GNU General Public License for more details. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with Xara LX (see the file GPL in the root directory of the 00026 distribution); if not, write to the Free Software Foundation, Inc., 51 00027 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00028 00029 00030 ADDITIONAL RIGHTS 00031 ----------------- 00032 00033 Conditional upon your continuing compliance with the GNU General Public 00034 License described above, Xara Group Ltd grants to you certain additional 00035 rights. 00036 00037 The additional rights are to use, modify, and distribute the software 00038 together with the wxWidgets library, the wxXtra library, and the "CDraw" 00039 library and any other such library that any version of Xara LX relased 00040 by Xara Group Ltd requires in order to compile and execute, including 00041 the static linking of that library to XaraLX. In the case of the 00042 "CDraw" library, you may satisfy obligation under the GNU General Public 00043 License to provide source code by providing a binary copy of the library 00044 concerned and a copy of the license accompanying it. 00045 00046 Nothing in this section restricts any of the rights you have under 00047 the GNU General Public License. 00048 00049 00050 SCOPE OF LICENSE 00051 ---------------- 00052 00053 This license applies to this program (XaraLX) and its constituent source 00054 files only, and does not necessarily apply to other Xara products which may 00055 in part share the same code base, and are subject to their own licensing 00056 terms. 00057 00058 This license does not apply to files in the wxXtra directory, which 00059 are built into a separate library, and are subject to the wxWindows 00060 license contained within that directory in the file "WXXTRA-LICENSE". 00061 00062 This license does not apply to the binary libraries (if any) within 00063 the "libs" directory, which are subject to a separate license contained 00064 within that directory in the file "LIBS-LICENSE". 00065 00066 00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS 00068 ---------------------------------------------- 00069 00070 Subject to the terms of the GNU Public License (see above), you are 00071 free to do whatever you like with your modifications. However, you may 00072 (at your option) wish contribute them to Xara's source tree. You can 00073 find details of how to do this at: 00074 http://www.xaraxtreme.org/developers/ 00075 00076 Prior to contributing your modifications, you will need to complete our 00077 contributor agreement. This can be found at: 00078 http://www.xaraxtreme.org/developers/contribute/ 00079 00080 Please note that Xara will not accept modifications which modify any of 00081 the text between the start and end of this header (marked 00082 XARAHEADERSTART and XARAHEADEREND). 00083 00084 00085 MARKS 00086 ----- 00087 00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara 00089 designs are registered or unregistered trademarks, design-marks, and/or 00090 service marks of Xara Group Ltd. All rights in these marks are reserved. 00091 00092 00093 Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK. 00094 http://www.xara.com/ 00095 00096 =================================XARAHEADEREND============================ 00097 */ 00098 00099 00100 00101 #include "camtypes.h" 00102 //#include "ensure.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00103 //#include "xlong.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00104 00105 DECLARE_SOURCE("$Revision: 1282 $"); 00106 00107 #if !defined(USE_NATIVE_XLONG) 00108 00109 /******************************************************************************************** 00110 00111 > void XLONG::ToString() const 00112 00113 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00114 Created: 2/6/93 00115 SeeAlso: Xlongasm.h 00116 Inputs: None. 00117 Outputs: None 00118 Returns: Returns a string representing the value of a XLONG. 00119 Purpose: Converts value of XLONG into an ASCII string representing it. 00120 Errors: None. 00121 00122 ********************************************************************************************/ 00123 /* 00124 Technical notes: 00125 00126 ********************************************************************************************/ 00127 00128 void xlong::ToString(String* out) const 00129 { 00130 TCHAR s[21]; 00131 00132 XlongToAscii(*this, s); 00133 00134 *out = s; 00135 } 00136 00137 00138 // Friend Functions - Basic Operators 00139 00140 /******************************************************************************************** 00141 00142 > XLONG operator+ (const XLONG& operand1, const XLONG& operand2) 00143 00144 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00145 Created: 26/4/93 00146 SeeAlso: Xlongasm.h 00147 Friend: XLONG 00148 Inputs: Two values to be added together. 00149 Outputs: None. 00150 Returns: An XLONG with result of addition. 00151 Purpose: Overloading the addition operator for XLONGs. 00152 Errors: None. 00153 00154 ********************************************************************************************/ 00155 /* 00156 Technical notes: 00157 00158 ********************************************************************************************/ 00159 00160 00161 xlong operator+ (const xlong& operand1, const xlong& operand2) 00162 { 00163 xlong result = operand1; 00164 00165 XlongAddOne(operand2, result); 00166 00167 return result; 00168 } 00169 00170 /******************************************************************************************** 00171 00172 > XLONG operator+ (const XLONG& operand1, INT32 operand2) 00173 00174 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00175 Created: 5/5/93 00176 SeeAlso: Xlongasm.h 00177 Friend: XLONG 00178 Inputs: Two values to be added together. 00179 Outputs: None. 00180 Returns: An XLONG with result of addition. 00181 Purpose: Overloading the addition operator for XLONGs. 00182 Errors: None. 00183 00184 ********************************************************************************************/ 00185 /* 00186 Technical notes: 00187 00188 ********************************************************************************************/ 00189 00190 00191 xlong operator+ (const xlong& operand1, INT32 operand2) 00192 { 00193 xlong result = operand1; 00194 xlong temp; 00195 00196 LongToXlong(operand2, temp); 00197 00198 XlongAddOne(temp, result); 00199 00200 return result; 00201 } 00202 00203 /******************************************************************************************** 00204 00205 > XLONG operator+ (const XLONG& operand1, INT32 operand2) 00206 00207 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00208 Created: 5/5/93 00209 SeeAlso: Xlongasm.h 00210 Friend: XLONG 00211 Inputs: Two values to be added together. 00212 Outputs: None. 00213 Returns: An XLONG with result of addition. 00214 Purpose: Overloading the addition operator for XLONGs. 00215 Errors: None. 00216 00217 ********************************************************************************************/ 00218 /* 00219 Technical notes: 00220 00221 ********************************************************************************************/ 00222 00223 00224 xlong operator+ (const xlong& operand1, INT32 operand2) 00225 { 00226 xlong result = operand1; 00227 xlong temp; 00228 00229 LongToXlong((INT32)operand2, temp); 00230 00231 XlongAddOne(temp, result); 00232 00233 return result; 00234 } 00235 00236 /******************************************************************************************** 00237 00238 > XLONG operator- (const XLONG& operand1, const XLONG& operand2) 00239 00240 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00241 Created: 26/4/93 00242 SeeAlso: Xlongasm.h 00243 Friend: XLONG 00244 Inputs: Two values to be subtracted from each other. 00245 Outputs: None. 00246 Returns: An XLONG with result of subtraction. 00247 Purpose: Overloading the subtract operator for XLONGs. 00248 Errors: None. 00249 00250 ********************************************************************************************/ 00251 /* 00252 Technical notes: 00253 00254 ********************************************************************************************/ 00255 00256 xlong operator- (const xlong& operand1, const xlong& operand2) 00257 { 00258 xlong result = operand1; 00259 00260 XlongSubOne(operand2, result); 00261 00262 return result; 00263 } 00264 00265 /******************************************************************************************** 00266 00267 > XLONG operator- (const XLONG& operand1, const INT32 operand2) 00268 00269 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00270 Created: 5/5/93 00271 SeeAlso: Xlongasm.h 00272 Friend: XLONG 00273 Inputs: Two values to be subtracted from each other. 00274 Outputs: None. 00275 Returns: An XLONG with result of subtraction. 00276 Purpose: Overloading the subtract operator for XLONGs. 00277 Errors: None. 00278 00279 ********************************************************************************************/ 00280 /* 00281 Technical notes: 00282 00283 ********************************************************************************************/ 00284 00285 xlong operator- (const xlong& operand1, INT32 operand2) 00286 { 00287 xlong result = operand1; 00288 xlong temp; 00289 00290 LongToXlong(operand2, temp); 00291 00292 XlongSubOne(temp, result); 00293 00294 return result; 00295 } 00296 00297 /******************************************************************************************** 00298 00299 > XLONG operator- (const XLONG& operand1, INT32 operand2) 00300 00301 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00302 Created: 5/5/93 00303 SeeAlso: Xlongasm.h 00304 Friend: XLONG 00305 Inputs: Two values to be subtracted from each other. 00306 Outputs: None. 00307 Returns: An XLONG with result of subtraction. 00308 Purpose: Overloading the subtract operator for XLONGs. 00309 Errors: None. 00310 00311 ********************************************************************************************/ 00312 /* 00313 Technical notes: 00314 00315 ********************************************************************************************/ 00316 00317 xlong operator- (const xlong& operand1, INT32 operand2) 00318 { 00319 xlong result = operand1; 00320 xlong temp; 00321 00322 LongToXlong((INT32)operand2, temp); 00323 00324 XlongSubOne(temp, result); 00325 00326 return result; 00327 } 00328 00329 /******************************************************************************************** 00330 00331 > XLONG operator- (const XLONG& operand) 00332 00333 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 00334 Created: 30/5/93 00335 SeeAlso: Xlongasm.h 00336 Friend: XLONG 00337 Inputs: Value for negation. 00338 Outputs: None. 00339 Returns: The negated value. 00340 Purpose: Overloading the negation operator for XLONGs. 00341 Errors: None. 00342 00343 ********************************************************************************************/ 00344 00345 xlong operator- (const xlong& input) 00346 { 00347 xlong temp; 00348 00349 XlongNegOne( temp = input ); 00350 return temp; 00351 } 00352 00353 /******************************************************************************************** 00354 00355 > XLONG operator* (const XLONG& operand1, const XLONG& operand2) 00356 00357 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00358 Created: 26/4/93 00359 SeeAlso: Xlongasm.h 00360 Friend: XLONG 00361 Inputs: Two values to be multiplied togther. 00362 Outputs: None. 00363 Returns: An XLONG with result of multiplication. 00364 Purpose: Overloading the multiplication operator for XLONGs. 00365 Errors: None. 00366 00367 ********************************************************************************************/ 00368 /* 00369 Technical notes: 00370 00371 ********************************************************************************************/ 00372 00373 xlong operator* (const xlong& operand1, const xlong& operand2) 00374 { 00375 xlong result = operand1; 00376 00377 XMul64One(operand2, result); 00378 00379 return result; 00380 } 00381 00382 /******************************************************************************************** 00383 00384 > XLONG operator* (const XLONG& operand1, INT32 operand2) 00385 00386 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00387 Created: 5/5/93 00388 SeeAlso: Xlongasm.h 00389 Friend: XLONG 00390 Inputs: Two values to be multiplied togther. 00391 Outputs: None. 00392 Returns: An XLONG with result of multiplication. 00393 Purpose: Overloading the multiplication operator for XLONGs. 00394 Errors: None. 00395 00396 ********************************************************************************************/ 00397 /* 00398 Technical notes: 00399 00400 ********************************************************************************************/ 00401 00402 xlong operator* (const xlong& operand1, INT32 operand2) 00403 { 00404 xlong result = operand1; 00405 xlong temp; 00406 00407 LongToXlong(operand2, temp); 00408 00409 XMul64One(temp, result); 00410 00411 return result; 00412 } 00413 00414 /******************************************************************************************** 00415 00416 > XLONG operator* (const XLONG& operand1, INT32 operand2) 00417 00418 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00419 Created: 5/5/93 00420 SeeAlso: Xlongasm.h 00421 Friend: XLONG 00422 Inputs: Two values to be multiplied togther. 00423 Outputs: None. 00424 Returns: An XLONG with result of multiplication. 00425 Purpose: Overloading the multiplication operator for XLONGs. 00426 Errors: None. 00427 00428 ********************************************************************************************/ 00429 /* 00430 Technical notes: 00431 00432 ********************************************************************************************/ 00433 00434 xlong operator* (const xlong& operand1, INT32 operand2) 00435 { 00436 xlong result = operand1; 00437 xlong temp; 00438 00439 LongToXlong((INT32)operand2, temp); 00440 00441 XMul64One(temp, result); 00442 00443 return result; 00444 } 00445 00446 #endif 00447 00448 /******************************************************************************************** 00449 00450 > XLONG operator* (const XLONG& operand1, FIXED16 operand2) 00451 00452 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 00453 Created: 30/5/93 00454 SeeAlso: Xlongasm.h 00455 Friend: XLONG 00456 Inputs: Two values to be multiplied togther. 00457 Outputs: None. 00458 Returns: An XLONG with result of multiplication. 00459 Purpose: Overloading the multiplication operator for XLONGs and FIXED16s. 00460 Errors: None. 00461 00462 ********************************************************************************************/ 00463 00464 xlong operator* (const xlong& operand1, FIXED16 operand2) 00465 { 00466 xlong temp = operand1; 00467 00468 XlongByFixed16One( &temp, operand2 ); // more efficient to pass 1 ptr than 2 00469 00470 return temp; 00471 } 00472 00473 #if !defined(USE_NATIVE_XLONG) 00474 00475 /******************************************************************************************** 00476 00477 > XLONG operator/ (const XLONG& operand1, const XLONG& operand2) 00478 00479 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00480 Created: 26/4/93 00481 SeeAlso: Xlongasm.h 00482 Friend: XLONG 00483 Inputs: Two values to be divided. 00484 Outputs: None. 00485 Returns: An XLONG with result of division. 00486 Purpose: Overloading the division operator for XLONGs. 00487 Errors: None. 00488 00489 ********************************************************************************************/ 00490 /* 00491 Technical notes: 00492 00493 ********************************************************************************************/ 00494 00495 xlong operator/ (const xlong& operand1, const xlong& operand2) 00496 { 00497 xlong result = operand1; 00498 00499 XDiv64One(operand2, result); 00500 00501 return result; 00502 } 00503 00504 /******************************************************************************************** 00505 00506 > XLONG operator/ (const XLONG& operand1, INT32 operand2) 00507 00508 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00509 Created: 5/5/93 00510 SeeAlso: Xlongasm.h 00511 Friend: XLONG 00512 Inputs: Two values to be divided. 00513 Outputs: None. 00514 Returns: An XLONG with result of division. 00515 Purpose: Overloading the division operator for XLONGs. 00516 Errors: None. 00517 00518 ********************************************************************************************/ 00519 /* 00520 Technical notes: 00521 00522 ********************************************************************************************/ 00523 00524 xlong operator/ (const xlong& operand1, INT32 operand2) 00525 { 00526 xlong result = operand1; 00527 xlong temp; 00528 00529 LongToXlong(operand2, temp); 00530 00531 XDiv64One(temp, result); 00532 00533 return result; 00534 } 00535 00536 /******************************************************************************************** 00537 00538 > XLONG operator/ (const XLONG& operand1, INT32 operand2) 00539 00540 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00541 Created: 5/5/93 00542 SeeAlso: Xlongasm.h 00543 Friend: XLONG 00544 Inputs: Two values to be divided. 00545 Outputs: None. 00546 Returns: An XLONG with result of division. 00547 Purpose: Overloading the division operator for XLONGs. 00548 Errors: None. 00549 00550 ********************************************************************************************/ 00551 /* 00552 Technical notes: 00553 00554 ********************************************************************************************/ 00555 00556 xlong operator/ (const xlong& operand1, INT32 operand2) 00557 { 00558 xlong result = operand1; 00559 xlong temp; 00560 00561 LongToXlong((INT32)operand2, temp); 00562 00563 XDiv64One(temp, result); 00564 00565 return result; 00566 } 00567 00568 #endif 00569 00570 /******************************************************************************************** 00571 00572 > XLONG operator/ (const XLONG& operand1, const FIXED16& operand2) 00573 00574 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00575 Created: 5/5/93 00576 Friend: XLONG 00577 SeeAlso: Xlongasm.h 00578 Inputs: Two values to be divided. 00579 Outputs: None. 00580 Returns: An XLONG with result of division. 00581 Purpose: Overloading the division operator for XLONGs. 00582 Errors: None. 00583 00584 ********************************************************************************************/ 00585 /* 00586 Technical notes: 00587 00588 ********************************************************************************************/ 00589 00590 xlong operator/ (const xlong& operand1, const fixed16& operand2) 00591 { 00592 xlong result; 00593 00594 result = operand1; 00595 00596 // XlongByFixed16One(&result, operand2); 00597 ENSURE( FALSE, "You are using the XLONG / operator which actually multiplies!" ); 00598 00599 return result; 00600 } 00601 00602 #if !defined(USE_NATIVE_XLONG) 00603 00604 /******************************************************************************************** 00605 00606 > XLONG operator>> (const XLONG& operand, UINT32 shift) 00607 00608 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00609 Created: 26/4/93 00610 SeeAlso: Xlongasm.h 00611 Friend: XLONG 00612 Inputs: operand1 - value to be shifted. 00613 operand2 - shift count. 00614 Outputs: None. 00615 Returns: An XLONG with result of ASR. 00616 Purpose: Overloading the >> operator to mean shift right for XLONGs. 00617 Errors: None. 00618 00619 ********************************************************************************************/ 00620 /* 00621 Technical notes: 00622 00623 ********************************************************************************************/ 00624 00625 xlong operator>> (const xlong& operand, UINT32 shift) 00626 { 00627 xlong result = operand; 00628 00629 XlongAsr64One(shift, result); 00630 00631 return result; 00632 } 00633 00634 /******************************************************************************************** 00635 00636 > XLONG operator<< (const XLONG& operand, UINT32 shift) 00637 00638 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00639 Created: 26/4/93 00640 SeeAlso: Xlongasm.h 00641 Friend: XLONG 00642 Inputs: operand - shift count. 00643 Outputs: None. 00644 Returns: An XLONG with result of ASL. 00645 Purpose: Overloading the << operator to mean shift left for XLONGs. 00646 Errors: None. 00647 00648 ********************************************************************************************/ 00649 /* 00650 Technical notes: 00651 00652 ********************************************************************************************/ 00653 00654 xlong operator<< (const xlong& operand, UINT32 shift) 00655 { 00656 xlong result = operand; 00657 00658 XlongAsl64One(shift, result); 00659 00660 return result; 00661 } 00662 00663 // Assignment Operators 00664 00665 /******************************************************************************************** 00666 00667 > XLONG& XLONG::operator= (const XLONG& operand) 00668 00669 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00670 Created: 26/4/93 00671 Inputs: operand to be assigned - rhs of assignment. 00672 Outputs: None. 00673 Returns: A reference to an XLONG with result of assignment. 00674 Purpose: Overloading the assignment operator for XLONGs. 00675 Errors: None. 00676 00677 ********************************************************************************************/ 00678 /* 00679 Technical notes: 00680 00681 ********************************************************************************************/ 00682 00683 xlong& xlong::operator= (const xlong& operand) 00684 { 00685 this->low = operand.low; 00686 this->high = operand.high; 00687 00688 return *this; 00689 } 00690 00691 /******************************************************************************************** 00692 00693 > XLONG& XLONG::operator= (INT32 operand) 00694 00695 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00696 Created: 5/5/93 00697 SeeAlso: Xlongasm.h 00698 Inputs: operand to be assigned - rhs of assignment. 00699 Outputs: None. 00700 Returns: A reference to an XLONG with result of assignment. 00701 Purpose: Overloading the assignment operator for XLONGs. 00702 Errors: None. 00703 00704 ********************************************************************************************/ 00705 /* 00706 Technical notes: 00707 00708 ********************************************************************************************/ 00709 00710 xlong& xlong::operator= (INT32 operand) 00711 { 00712 xlong temp; 00713 00714 LongToXlong(operand, temp); 00715 00716 this->low = temp.low; 00717 this->high = temp.high; 00718 00719 return *this; 00720 } 00721 00722 /******************************************************************************************** 00723 00724 > XLONG& XLONG::operator+= (const XLONG& operand) 00725 00726 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00727 Created: 26/4/93 00728 SeeAlso: Xlongasm.h 00729 Inputs: lvalue to be incremented 00730 operand to be added - rhs of assignment. 00731 Outputs: None. 00732 Returns: A reference to an XLONG with result of assignment. 00733 Purpose: Overloading the plus-equals operator for XLONGs. 00734 Errors: None. 00735 00736 ********************************************************************************************/ 00737 /* 00738 Technical notes: 00739 00740 ********************************************************************************************/ 00741 00742 xlong& xlong::operator+= (const xlong& operand) 00743 { 00744 XlongAddOne(operand, *this); 00745 00746 return *this; 00747 } 00748 00749 /******************************************************************************************** 00750 00751 > XLONG& XLONG::operator+= (INT32 operand) 00752 00753 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00754 Created: 5/5/93 00755 SeeAlso: Xlongasm.h 00756 Inputs: lvalue to be incremented 00757 operand to be added - rhs of assignment. 00758 Outputs: None. 00759 Returns: A reference to an XLONG with result of assignment. 00760 Purpose: Overloading the plus-equals operator for XLONGs. 00761 Errors: None. 00762 00763 ********************************************************************************************/ 00764 /* 00765 Technical notes: 00766 00767 ********************************************************************************************/ 00768 00769 xlong& xlong::operator+= (INT32 operand) 00770 { 00771 xlong temp; 00772 00773 LongToXlong(operand, temp); 00774 00775 XlongAddOne(temp, *this); 00776 00777 return *this; 00778 } 00779 00780 /******************************************************************************************** 00781 00782 > XLONG& XLONG::operator-= (const XLONG& operand) 00783 00784 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00785 Created: 26/4/93 00786 SeeAlso: Xlongasm.h 00787 Inputs: lvalue to be incremented 00788 operand to be subtracted - rhs of assignment. 00789 Outputs: None. 00790 Returns: A reference to an XLONG with result of assignment. 00791 Purpose: Overloading the minus-equals operator for XLONGs. 00792 Errors: None. 00793 00794 ********************************************************************************************/ 00795 /* 00796 Technical notes: 00797 00798 ********************************************************************************************/ 00799 00800 xlong& xlong::operator-= (const xlong& operand) 00801 { 00802 XlongSubOne(operand, *this); 00803 00804 return *this; 00805 } 00806 00807 /******************************************************************************************** 00808 00809 > XLONG& XLONG::operator-= (INT32 operand) 00810 00811 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00812 Created: 5/5/93 00813 SeeAlso: Xlongasm.h 00814 Inputs: operand to be subtracted - rhs of assignment. 00815 Outputs: None. 00816 Returns: A reference to an XLONG with result of assignment. 00817 Purpose: Overloading the minus-equals operator for XLONGs. 00818 Errors: None. 00819 00820 ********************************************************************************************/ 00821 /* 00822 Technical notes: 00823 00824 ********************************************************************************************/ 00825 00826 xlong& xlong::operator-= (INT32 operand) 00827 { 00828 xlong temp; 00829 00830 LongToXlong(operand, temp); 00831 00832 XlongSubOne(temp, *this); 00833 00834 return *this; 00835 } 00836 00837 /******************************************************************************************** 00838 00839 > XLONG& XLONG::operator*= (const XLONG& operand) 00840 00841 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00842 Created: 26/4/93 00843 SeeAlso: Xlongasm.h 00844 Inputs: multiplier - rhs of assignment. 00845 Outputs: None. 00846 Returns: A reference to an XLONG with result of assignment. 00847 Purpose: Overloading the times-equals operator for XLONGs. 00848 Errors: None. 00849 00850 ********************************************************************************************/ 00851 /* 00852 Technical notes: 00853 00854 ********************************************************************************************/ 00855 00856 xlong& xlong::operator*= (const xlong& operand) 00857 { 00858 XMul64One(operand, *this); 00859 00860 return *this; 00861 } 00862 00863 /******************************************************************************************** 00864 00865 > XLONG& XLONG::operator*= (INT32 operand) 00866 00867 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00868 Created: 5/5/93 00869 SeeAlso: Xlongasm.h 00870 Inputs: multiplier - rhs of assignment. 00871 Outputs: None. 00872 Returns: A reference to an XLONG with result of assignment. 00873 Purpose: Overloading the times-equals operator for XLONGs. 00874 Errors: None. 00875 00876 ********************************************************************************************/ 00877 /* 00878 Technical notes: 00879 00880 ********************************************************************************************/ 00881 00882 xlong& xlong::operator*= (INT32 operand) 00883 { 00884 xlong temp; 00885 00886 LongToXlong(operand, temp); 00887 00888 XMul64One(temp, *this); 00889 00890 return *this; 00891 } 00892 00893 #endif 00894 00895 /******************************************************************************************** 00896 00897 > XLONG& XLONG::operator*= (FIXED16 operand) 00898 00899 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 00900 Created: 30/5/93 00901 SeeAlso: Xlongasm.h 00902 Inputs: multiplier - rhs of assignment. 00903 Outputs: None. 00904 Returns: A reference to an XLONG with result of assignment. 00905 Purpose: Overloading the times-equals operator for XLONGs, multiplying by a fixed16. 00906 Errors: None (overflow ignored). 00907 SeeAlso: XlongByFixed16One 00908 00909 ********************************************************************************************/ 00910 00911 xlong &operator*=( xlong &xl, fixed16 fix ) 00912 { 00913 XlongByFixed16One( &xl, fix ); 00914 return xl; 00915 } 00916 00917 #if !defined(USE_NATIVE_XLONG) 00918 00919 /******************************************************************************************** 00920 00921 > XLONG& XLONG::operator/= (const XLONG& operand) 00922 00923 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00924 Created: 26/4/93 00925 SeeAlso: Xlongasm.h 00926 Inputs: divisor - rhs of assignment. 00927 Outputs: None. 00928 Returns: A reference to an XLONG with result of assignment. 00929 Purpose: Overloading the divide-equals operator for XLONGs. 00930 Errors: None. 00931 00932 ********************************************************************************************/ 00933 /* 00934 Technical notes: 00935 00936 ********************************************************************************************/ 00937 00938 xlong& xlong::operator/= (const xlong& operand) 00939 { 00940 XDiv64One(operand, *this); 00941 00942 return *this; 00943 } 00944 00945 /******************************************************************************************** 00946 00947 > XLONG& XLONG::operator/= (INT32 operand) 00948 00949 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00950 Created: 5/5/93 00951 SeeAlso: Xlongasm.h 00952 Inputs: divisor - rhs of assignment. 00953 Outputs: None. 00954 Returns: A reference to an XLONG with result of assignment. 00955 Purpose: Overloading the divide-equals operator for XLONGs. 00956 Errors: None. 00957 00958 ********************************************************************************************/ 00959 /* 00960 Technical notes: 00961 00962 ********************************************************************************************/ 00963 00964 xlong& xlong::operator/= (INT32 operand) 00965 { 00966 xlong temp; 00967 00968 LongToXlong(operand, temp); 00969 00970 XDiv64One(temp, *this); 00971 00972 return *this; 00973 } 00974 00975 /******************************************************************************************** 00976 00977 > XLONG& XLONG::operator<<= (UINT32 shift) 00978 00979 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 00980 Created: 26/4/93 00981 SeeAlso: Xlongasm.h 00982 Inputs: shift count - rhs of assignment. 00983 Outputs: None. 00984 Returns: A reference to an XLONG with result of assignment. 00985 Purpose: Overloading the left-shift-equals operator for XLONGs. 00986 Errors: None. 00987 00988 ********************************************************************************************/ 00989 /* 00990 Technical notes: 00991 00992 ********************************************************************************************/ 00993 00994 xlong& xlong::operator<<= (UINT32 shift) 00995 { 00996 XlongAsl64One(shift, *this); 00997 00998 return *this; 00999 } 01000 01001 /******************************************************************************************** 01002 01003 > XLONG& XLONG::operator>>= (UINT32 operand) 01004 01005 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01006 Created: 26/4/93 01007 SeeAlso: Xlongasm.h 01008 Inputs: shift count - rhs of assignment. 01009 Outputs: None. 01010 Returns: A reference to an XLONG with result of assignment. 01011 Purpose: Overloading the right-shift-equals operator for XLONGs. 01012 Errors: None. 01013 01014 ********************************************************************************************/ 01015 /* 01016 Technical notes: 01017 01018 ********************************************************************************************/ 01019 01020 xlong& xlong::operator>>= (UINT32 shift) 01021 { 01022 XlongAsr64One(shift, *this); 01023 01024 return *this; 01025 } 01026 01027 // Increment\Decrement Operators 01028 01029 /******************************************************************************************** 01030 01031 > XLONG& XLONG::operator++ () 01032 01033 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01034 Created: 26/4/93 01035 SeeAlso: Xlongasm.h 01036 Inputs: None. 01037 Outputs: None. 01038 Returns: A reference to an XLONG with result of increment. 01039 Purpose: Overloading the prefix plus-plus operator for XLONGs. 01040 Errors: None. 01041 01042 ********************************************************************************************/ 01043 /* 01044 Technical notes: 01045 01046 ********************************************************************************************/ 01047 01048 xlong& xlong::operator++ () // prefix 01049 { 01050 XlongIncrement(*this); 01051 01052 return *this; 01053 } 01054 01055 /******************************************************************************************** 01056 01057 > XLONG XLONG::operator++ (INT32 dummy) 01058 01059 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01060 Created: 26/4/93 01061 SeeAlso: Xlongasm.h 01062 Inputs: dummy value to distinguish between pre- and post-fix application. 01063 Outputs: None. 01064 Returns: An XLONG with result of increment. 01065 Purpose: Overloading the postfix plus-plus operator for XLONGs. 01066 Errors: None. 01067 01068 ********************************************************************************************/ 01069 /* 01070 Technical notes: 01071 01072 ********************************************************************************************/ 01073 01074 xlong xlong::operator++ (INT32 dummy) // postfix 01075 { 01076 xlong result = *this; 01077 01078 XlongIncrement(*this); 01079 01080 return result; 01081 } 01082 01083 /******************************************************************************************** 01084 01085 > XLONG& XLONG::operator-- () 01086 01087 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01088 Created: 26/4/93 01089 SeeAlso: Xlongasm.h 01090 Inputs: None. 01091 Outputs: None. 01092 Returns: A reference to an XLONG with result of decrement. 01093 Purpose: Overloading the prefix minus-minus operator for XLONGs. 01094 Errors: None. 01095 01096 ********************************************************************************************/ 01097 /* 01098 Technical notes: 01099 01100 ********************************************************************************************/ 01101 01102 xlong& xlong::operator-- () // prefix 01103 { 01104 XlongDecrement(*this); 01105 01106 return *this; 01107 } 01108 01109 /******************************************************************************************** 01110 01111 > XLONG XLONG::operator-- (INT32 dummy) 01112 01113 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01114 Created: 26/4/93 01115 SeeAlso: Xlongasm.h 01116 Inputs: dummy value to distinguish between pre- and post-fix application. 01117 Outputs: None. 01118 Returns: An XLONG with result of decrement. 01119 Purpose: Overloading the postfix minus-minus operator for XLONGs. 01120 Errors: None. 01121 01122 ********************************************************************************************/ 01123 /* 01124 Technical notes: 01125 01126 ********************************************************************************************/ 01127 01128 xlong xlong::operator-- (INT32 dummy) // postfix 01129 { 01130 xlong result = *this; 01131 01132 XlongDecrement(*this); 01133 01134 return result; 01135 } 01136 01137 // Relational Operators 01138 01139 /******************************************************************************************** 01140 01141 > INT32 operator== (const XLONG& first, const XLONG& second) 01142 01143 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01144 Created: 26/4/93 01145 SeeAlso: Xlongasm.h 01146 Friend: XLONG 01147 Inputs: Two XLONGs to be compared 01148 Outputs: None. 01149 Returns: Integer - 0 = False 01150 1 = True 01151 Purpose: Overloading the postfix equality operator for XLONGs. 01152 Errors: None. 01153 01154 ********************************************************************************************/ 01155 /* 01156 Technical notes: 01157 01158 ********************************************************************************************/ 01159 01160 INT32 operator== (const xlong& first, const xlong& second) 01161 { 01162 return XlongCmpEQ(first, second); 01163 } 01164 01165 /******************************************************************************************** 01166 01167 > INT32 operator== (const XLONG& first, INT32 second) 01168 01169 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01170 Created: 26/4/93 01171 SeeAlso: Xlongasm.h 01172 Friend: XLONG 01173 Inputs: Two values to be compared 01174 Outputs: None. 01175 Returns: Integer - 0 = False 01176 1 = True 01177 Purpose: Overloading the postfix equality operator for XLONGs. 01178 Errors: None. 01179 01180 ********************************************************************************************/ 01181 /* 01182 Technical notes: 01183 01184 ********************************************************************************************/ 01185 01186 INT32 operator== (const xlong& first, INT32 second) 01187 { 01188 xlong temp; 01189 01190 LongToXlong(second, temp); 01191 01192 return XlongCmpEQ(first, temp); 01193 } 01194 01195 /******************************************************************************************** 01196 01197 > INT32 operator== (const XLONG& first, INT32 second) 01198 01199 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01200 Created: 26/4/93 01201 SeeAlso: Xlongasm.h 01202 Friend: XLONG 01203 Inputs: Two values to be compared 01204 Outputs: None. 01205 Returns: Integer - 0 = False 01206 1 = True 01207 Purpose: Overloading the postfix equality operator for XLONGs. 01208 Errors: None. 01209 01210 ********************************************************************************************/ 01211 /* 01212 Technical notes: 01213 01214 ********************************************************************************************/ 01215 01216 INT32 operator== (const xlong& first, INT32 second) 01217 { 01218 xlong temp; 01219 01220 LongToXlong((INT32)second, temp); 01221 01222 return XlongCmpEQ(first, temp); 01223 } 01224 01225 /******************************************************************************************** 01226 01227 > INT32 operator!= (const XLONG& first, const XLONG& second) 01228 01229 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01230 Created: 26/4/93 01231 SeeAlso: Xlongasm.h 01232 Friend: XLONG 01233 Inputs: Two XLONGs to be compared 01234 Outputs: None. 01235 Returns: Integer - 0 = False 01236 1 = True 01237 Purpose: Overloading the postfix inequality operator for XLONGs. 01238 Errors: None. 01239 01240 ********************************************************************************************/ 01241 /* 01242 Technical notes: 01243 01244 ********************************************************************************************/ 01245 01246 INT32 operator!= (const xlong& first, const xlong& second) 01247 { 01248 return XlongCmpNE(first, second); 01249 } 01250 01251 /******************************************************************************************** 01252 01253 > INT32 operator!= (const XLONG& first, INT32 second) 01254 01255 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01256 Created: 26/4/93 01257 SeeAlso: Xlongasm.h 01258 Friend: XLONG 01259 Inputs: Two valuess to be compared 01260 Outputs: None. 01261 Returns: Integer - 0 = False 01262 1 = True 01263 Purpose: Overloading the postfix inequality operator for XLONGs. 01264 Errors: None. 01265 01266 ********************************************************************************************/ 01267 /* 01268 Technical notes: 01269 01270 ********************************************************************************************/ 01271 01272 INT32 operator!= (const xlong& first, INT32 second) 01273 { 01274 xlong temp; 01275 01276 LongToXlong(second, temp); 01277 01278 return XlongCmpNE(first, temp); 01279 } 01280 01281 /******************************************************************************************** 01282 01283 > INT32 operator!= (const XLONG& first, INT32 second) 01284 01285 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01286 Created: 26/4/93 01287 SeeAlso: Xlongasm.h 01288 Friend: XLONG 01289 Inputs: Two valuess to be compared 01290 Outputs: None. 01291 Returns: Integer - 0 = False 01292 1 = True 01293 Purpose: Overloading the postfix inequality operator for XLONGs. 01294 Errors: None. 01295 01296 ********************************************************************************************/ 01297 /* 01298 Technical notes: 01299 01300 ********************************************************************************************/ 01301 01302 INT32 operator!= (const xlong& first, INT32 second) 01303 { 01304 xlong temp; 01305 01306 LongToXlong((INT32)second, temp); 01307 01308 return XlongCmpNE(first, temp); 01309 } 01310 01311 /******************************************************************************************** 01312 01313 > INT32 operator< (const XLONG& first, const XLONG& second) 01314 01315 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01316 Created: 26/4/93 01317 SeeAlso: Xlongasm.h 01318 Friend: XLONG 01319 Inputs: Two XLONGs to be compared 01320 Outputs: None. 01321 Returns: Integer - 0 = False 01322 1 = True 01323 Purpose: Overloading the postfix less-than operator for XLONGs. 01324 Errors: None. 01325 01326 ********************************************************************************************/ 01327 /* 01328 Technical notes: 01329 01330 ********************************************************************************************/ 01331 01332 INT32 operator< (const xlong& first, const xlong& second) 01333 { 01334 return XlongCmpLT(first, second); 01335 } 01336 01337 /******************************************************************************************** 01338 01339 > INT32 operator< (const XLONG& first, INT32 second) 01340 01341 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01342 Created: 26/4/93 01343 SeeAlso: Xlongasm.h 01344 Friend: XLONG 01345 Inputs: Two values to be compared 01346 Outputs: None. 01347 Returns: Integer - 0 = False 01348 1 = True 01349 Purpose: Overloading the postfix less-than operator for XLONGs. 01350 Errors: None. 01351 01352 ********************************************************************************************/ 01353 /* 01354 Technical notes: 01355 01356 ********************************************************************************************/ 01357 01358 INT32 operator< (const xlong& first, INT32 second) 01359 { 01360 xlong temp; 01361 01362 LongToXlong(second, temp); 01363 01364 return XlongCmpLT(first, temp); 01365 } 01366 01367 /******************************************************************************************** 01368 01369 > INT32 operator< (const XLONG& first, INT32 second) 01370 01371 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01372 Created: 26/4/93 01373 SeeAlso: Xlongasm.h 01374 Friend: XLONG 01375 Inputs: Two values to be compared 01376 Outputs: None. 01377 Returns: Integer - 0 = False 01378 1 = True 01379 Purpose: Overloading the postfix less-than operator for XLONGs. 01380 Errors: None. 01381 01382 ********************************************************************************************/ 01383 /* 01384 Technical notes: 01385 01386 ********************************************************************************************/ 01387 01388 INT32 operator< (const xlong& first, INT32 second) 01389 { 01390 xlong temp; 01391 01392 LongToXlong((INT32)second, temp); 01393 01394 return XlongCmpLT(first, temp); 01395 } 01396 01397 /******************************************************************************************** 01398 01399 > INT32 operator> (const XLONG& first, const XLONG& second) 01400 01401 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01402 Created: 26/4/93 01403 SeeAlso: Xlongasm.h 01404 Friend: XLONG 01405 Inputs: Two XLONGs to be compared 01406 Outputs: None. 01407 Returns: Integer - 0 = False 01408 1 = True 01409 Purpose: Overloading the postfix greater-than operator for XLONGs. 01410 Errors: None. 01411 01412 ********************************************************************************************/ 01413 /* 01414 Technical notes: 01415 01416 ********************************************************************************************/ 01417 01418 INT32 operator> (const xlong& first, const xlong& second) 01419 { 01420 return XlongCmpGT(first, second); 01421 } 01422 01423 /******************************************************************************************** 01424 01425 > INT32 operator> (const XLONG& first, INT32 second) 01426 01427 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01428 Created: 26/4/93 01429 SeeAlso: Xlongasm.h 01430 Friend: XLONG 01431 Inputs: Two values to be compared 01432 Outputs: None. 01433 Returns: Integer - 0 = False 01434 1 = True 01435 Purpose: Overloading the postfix greater-than operator for XLONGs. 01436 Errors: None. 01437 01438 ********************************************************************************************/ 01439 /* 01440 Technical notes: 01441 01442 ********************************************************************************************/ 01443 01444 INT32 operator> (const xlong& first, INT32 second) 01445 { 01446 xlong temp; 01447 01448 LongToXlong(second, temp); 01449 01450 return XlongCmpGT(first, temp); 01451 } 01452 01453 /******************************************************************************************** 01454 01455 > INT32 operator> (const XLONG& first, INT32 second) 01456 01457 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01458 Created: 26/4/93 01459 SeeAlso: Xlongasm.h 01460 Friend: XLONG 01461 Inputs: Two values to be compared 01462 Outputs: None. 01463 Returns: Integer - 0 = False 01464 1 = True 01465 Purpose: Overloading the postfix greater-than operator for XLONGs. 01466 Errors: None. 01467 01468 ********************************************************************************************/ 01469 /* 01470 Technical notes: 01471 01472 ********************************************************************************************/ 01473 01474 INT32 operator> (const xlong& first, INT32 second) 01475 { 01476 xlong temp; 01477 01478 LongToXlong((INT32)second, temp); 01479 01480 return XlongCmpGT(first, temp); 01481 } 01482 01483 /******************************************************************************************** 01484 01485 > INT32 operator<= (const XLONG& first, const XLONG& second) 01486 01487 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01488 Created: 26/4/93 01489 SeeAlso: Xlongasm.h 01490 Friend: XLONG 01491 Inputs: Two XLONGs to be compared 01492 Outputs: None. 01493 Returns: Integer - 0 = False 01494 1 = True 01495 Purpose: Overloading the postfix less-than--or-equal operator for XLONGs. 01496 Errors: None. 01497 01498 ********************************************************************************************/ 01499 /* 01500 Technical notes: 01501 01502 ********************************************************************************************/ 01503 01504 INT32 operator<= (const xlong& first, const xlong& second) 01505 { 01506 return XlongCmpLE(first, second); 01507 } 01508 01509 /******************************************************************************************** 01510 01511 > INT32 operator<= (const XLONG& first, INT32 second) 01512 01513 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01514 Created: 26/4/93 01515 SeeAlso: Xlongasm.h 01516 Friend: XLONG 01517 Inputs: Two values to be compared 01518 Outputs: None. 01519 Returns: Integer - 0 = False 01520 1 = True 01521 Purpose: Overloading the postfix less-than--or-equal operator for XLONGs. 01522 Errors: None. 01523 01524 ********************************************************************************************/ 01525 /* 01526 Technical notes: 01527 01528 ********************************************************************************************/ 01529 01530 INT32 operator<= (const xlong& first, INT32 second) 01531 { 01532 xlong temp; 01533 01534 LongToXlong(second, temp); 01535 01536 return XlongCmpLE(first, temp); 01537 } 01538 01539 /******************************************************************************************** 01540 01541 > INT32 operator<= (const XLONG& first, INT32 second) 01542 01543 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01544 Created: 26/4/93 01545 SeeAlso: Xlongasm.h 01546 Friend: XLONG 01547 Inputs: Two values to be compared 01548 Outputs: None. 01549 Returns: Integer - 0 = False 01550 1 = True 01551 Purpose: Overloading the postfix less-than--or-equal operator for XLONGs. 01552 Errors: None. 01553 01554 ********************************************************************************************/ 01555 /* 01556 Technical notes: 01557 01558 ********************************************************************************************/ 01559 01560 INT32 operator<= (const xlong& first, INT32 second) 01561 { 01562 xlong temp; 01563 01564 LongToXlong((INT32)second, temp); 01565 01566 return XlongCmpLE(first, temp); 01567 } 01568 01569 /******************************************************************************************** 01570 01571 > INT32 operator>= (const XLONG& first, const XLONG& second) 01572 01573 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01574 Created: 26/4/93 01575 SeeAlso: Xlongasm.h 01576 Friend: XLONG 01577 Inputs: Two XLONGs to be compared 01578 Outputs: None. 01579 Returns: Integer - 0 = False 01580 1 = True 01581 Purpose: Overloading the postfix greater-than--or-equal operator for XLONGs. 01582 Errors: None. 01583 01584 ********************************************************************************************/ 01585 /* 01586 Technical notes: 01587 01588 ********************************************************************************************/ 01589 01590 INT32 operator>= (const xlong& first, const xlong& second) 01591 { 01592 return XlongCmpGE(first, second); 01593 } 01594 01595 /******************************************************************************************** 01596 01597 > INT32 operator>= (const XLONG& first, INT32 second) 01598 01599 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01600 Created: 26/4/93 01601 SeeAlso: Xlongasm.h 01602 Friend: XLONG 01603 Inputs: Two values to be compared 01604 Outputs: None. 01605 Returns: Integer - 0 = False 01606 1 = True 01607 Purpose: Overloading the postfix greater-than--or-equal operator for XLONGs. 01608 Errors: None. 01609 01610 ********************************************************************************************/ 01611 /* 01612 Technical notes: 01613 01614 ********************************************************************************************/ 01615 01616 INT32 operator>= (const xlong& first, INT32 second) 01617 { 01618 xlong temp; 01619 01620 LongToXlong(second, temp); 01621 01622 return XlongCmpGE(first, temp); 01623 } 01624 01625 /******************************************************************************************** 01626 01627 > INT32 operator>= (const XLONG& first, INT32 second) 01628 01629 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01630 Created: 26/4/93 01631 SeeAlso: Xlongasm.h 01632 Friend: XLONG 01633 Inputs: Two values to be compared 01634 Outputs: None. 01635 Returns: Integer - 0 = False 01636 1 = True 01637 Purpose: Overloading the postfix greater-than--or-equal operator for XLONGs. 01638 Errors: None. 01639 01640 ********************************************************************************************/ 01641 /* 01642 Technical notes: 01643 01644 ********************************************************************************************/ 01645 01646 INT32 operator>= (const xlong& first, INT32 second) 01647 { 01648 xlong temp; 01649 01650 LongToXlong((INT32)second, temp); 01651 01652 return XlongCmpGE(first, temp); 01653 } 01654 01655 /******************************************************************************************** 01656 01657 > FIXED16 XLONG::MakeFixed16 () 01658 01659 Author: Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com> 01660 Created: 26/4/93 01661 SeeAlso: Xlongasm.h 01662 Inputs: None. 01663 Outputs: None. 01664 Returns: INT32 value. 01665 Purpose: To convert an XLONG value to a FIXED16. 01666 Errors: None. 01667 01668 ********************************************************************************************/ 01669 /* 01670 Technical notes: 01671 01672 ********************************************************************************************/ 01673 01674 fixed16 xlong::MakeFixed16() const 01675 { 01676 return fixed16( (short)this->low ); 01677 } 01678 01679 #endif 01680 01681 /******************************************************************************************** 01682 01683 > void XlongAdd(Xlong *input1, Xlong *input2, Xlong *result) 01684 01685 > void XlongAddOne(xlong *input1, xlong *result) 01686 01687 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01688 Created: 27/4/93 01689 Scope: Private to Xlong class 01690 Inputs: 01691 Outputs: pointer to the xlong result 01692 Returns: None 01693 Purpose: 64-bit signed addition 01694 Errors: None (no overflow checks) 01695 01696 ********************************************************************************************/ 01697 01698 void XlongAdd( const xlong& input1,const xlong& input2, xlong& result ) 01699 { 01700 result = input1+input2 ; 01701 } 01702 01703 void XlongAddOne( const xlong& input, xlong& result ) 01704 { 01705 result += input ; 01706 } 01707 01708 01709 /******************************************************************************************** 01710 01711 > void XlongSub(Xlong *input1, Xlong *input2, Xlong *result) 01712 01713 > void XlongSubOne(xxlong *input, xlong *result) 01714 01715 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01716 Created: 27/4/93 01717 Scope: Private to Xlong class 01718 Inputs: 01719 Outputs: pointer to the xlong result (input1 - input2) or (result-=input) 01720 Returns: None 01721 Purpose: 64-bit signed subtraction 01722 Errors: None (no overflow checks) 01723 01724 Most of the overhead is in extracting the parameters from the pointers 01725 so this does *not* use macros to hide memory models etc 01726 ********************************************************************************************/ 01727 01728 void XlongSub( const xlong& input1,const xlong& input2, xlong& result ) 01729 { 01730 result = input1-input2 ; 01731 } 01732 01733 void XlongSubOne( const xlong& input, xlong& result ) 01734 { 01735 result -= input ; 01736 } 01737 01738 01739 /******************************************************************************************** 01740 01741 > extern "C" void XlongNegOne(Xlong *arg) 01742 01743 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01744 Created: 27/4/93 01745 Scope: Private to Xlong class 01746 Inputs: pointer to value requiring negation 01747 Outputs: contents of pointer pointer updated 01748 Returns: None 01749 Purpose: 64-bit signed negation 01750 Errors: None (no overflow checks) 01751 01752 ********************************************************************************************/ 01753 01754 void XlongNegOne( xlong& arg ) 01755 { 01756 arg = -arg ; 01757 } 01758 01759 /******************************************************************************************** 01760 01761 > INT32 Mul32Div32(INT32 mul1, INT32 mul2, INT32 divisor) 01762 01763 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01764 Created: 28/4/93 01765 Scope: Private to Xlong class 01766 Inputs: two multiplicands, one divisor 01767 Outputs: result of mul1*mul2/div using 64-bit intermediate result (signed) 01768 Returns: INT32 result 01769 Purpose: To avoid losing precision 01770 Errors: If divisor zero or overflow will INT32 0 (div0) 01771 01772 ********************************************************************************************/ 01773 01774 01775 INT32 Mul32Div32(INT32 mul1, INT32 mul2, INT32 divisor) 01776 { 01777 // return MulDiv(mul1,mul2,divisor) ; 01778 return INT32(((xlong)mul1*mul2)/divisor) ; 01779 } 01780 01781 /******************************************************************************************** 01782 01783 > void XMul32(INT32 mul1, INT32 mul2, Xlong& result) 01784 01785 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01786 Created: 28/4/93 01787 Scope: Private to Xlong class 01788 Inputs: two 32-bit multiplicands 01789 Outputs: signed 64-bit 01790 Returns: none 01791 Purpose: To avoid losing precision 01792 Errors: None (no overflow checks) 01793 01794 ********************************************************************************************/ 01795 01796 void XMul32(INT32 mul1, INT32 mul2, xlong& result) 01797 { 01798 result = (xlong)mul1*mul2 ; 01799 } 01800 01801 01802 /******************************************************************************************** 01803 01804 > void XMul64( const Xlong& m1,const Xlong& m2, Xlong& result) 01805 01806 > void XMul64One(const Xlong& m, Xlong& result) 01807 01808 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01809 Created: 28/4/93 01810 Scope: Private to Xlong class 01811 Inputs: two 64-bit multiplicands 01812 Outputs: signed 64-bit (m1*m2 or result*=m) 01813 Returns: none 01814 Purpose: Private to ccmath.h. Primitive for operator overloading 01815 Errors: None (no overflow checks) 01816 01817 ********************************************************************************************/ 01818 01819 void XMul64( const xlong& m1,const xlong& m2, xlong& result) 01820 { 01821 result = m1*m2 ; 01822 } 01823 01824 void XlongMulOne( const xlong& m, xlong& result ) 01825 { 01826 result *= m ; 01827 } 01828 01829 /******************************************************************************************** 01830 01831 > void longToXlong( const INT32 input, xlong& result) 01832 01833 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01834 Created: 29/4/93 01835 Scope: Private to Xlong class 01836 Inputs: 32-bit signed INT32 01837 Outputs: 64-bit signed xlong 01838 Returns: none 01839 Purpose: Private to ccmath.h. Primitive for operator overloading 01840 Errors: None possible 01841 01842 ********************************************************************************************/ 01843 01844 void longToXlong( const INT32 input, xlong& result) 01845 { 01846 result = input ; 01847 } 01848 01849 01850 /******************************************************************************************** 01851 01852 > INT32 XlongTolong( const xlong& input) 01853 01854 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01855 Created: 29/4/93 01856 Scope: Private to Xlong class 01857 Inputs: 64-bit signed xlong 01858 Outputs: 32-bit signed INT32 01859 Returns: none 01860 Purpose: Private to ccmath.cpp. Primitive for operator overloading 01861 Errors: None (overflow ignored) 01862 01863 ********************************************************************************************/ 01864 01865 INT32 XlongTolong( const xlong& input) 01866 { 01867 return (INT32)input ; 01868 } 01869 01870 01871 /******************************************************************************************** 01872 01873 > void XlongAsl64( const xlong& input, INT32 shift, xlong& result) 01874 01875 > void XlongAsl64One( INT32 shift, xlong& result) 01876 01877 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01878 Created: 29/4/93 01879 Scope: Private to Xlong class 01880 Inputs: 64-bit signed xlong, INT32 shift count 01881 Outputs: 64-bit signed xlong 01882 Returns: none 01883 Purpose: Private to ccmath.cpp. Primitive for operator overloading 01884 Errors: None (overflow ignored). The shift count is masked with 3F 01885 for compatibility with normal Intel shifts 01886 01887 ********************************************************************************************/ 01888 01889 void XlongAsl64( const xlong& input, INT32 shift, xlong& result) 01890 { 01891 result = input<<shift ; 01892 } 01893 01894 void XlongAsl64One( INT32 shift, xlong& result ) 01895 { 01896 result <<= shift ; 01897 } 01898 01899 /******************************************************************************************** 01900 01901 > void XlongAsr64( const xlong& input, INT32 count, xlong& result) 01902 01903 > void XlongAsr64One( INT32 count, xlong& result) 01904 01905 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01906 Created: 29/4/93 01907 Scope: Private to Xlong class 01908 Inputs: 64-bit signed xlong, INT32 shift count 01909 Outputs: 64-bit signed xlong 01910 Returns: none 01911 Purpose: Private to ccmath.cpp. Primitive for operator overloading 01912 Errors: None (overflow ignored). The shift count is masked with 3F 01913 for compatibility with normal Intel shifts 01914 01915 ********************************************************************************************/ 01916 01917 void XlongAsr64( const xlong& input, INT32 shift, xlong& result) 01918 { 01919 result = input>>shift ; 01920 } 01921 01922 void XlongAsr64One( INT32 shift, xlong& result ) 01923 { 01924 result >>= shift ; 01925 } 01926 01927 /******************************************************************************************** 01928 01929 > INT32 XlongCmp..( const xlong& first, const xlong& second) 01930 01931 .. = comparison operator, one of: 01932 GT > 01933 GE >= 01934 LT < 01935 LE <= 01936 EQ == 01937 NE != 01938 01939 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01940 Created: 29/4/93 01941 Scope: Private to Xlong class 01942 Inputs: two xlongs 01943 Outputs: returns 1 if comparison true, else 0 01944 Returns: none 01945 Purpose: Private to ccmath.cpp. Primitive for operator overloading 01946 Errors: None 01947 01948 ********************************************************************************************/ 01949 01950 INT32 XlongCmpGT( const xlong& first, const xlong& second) 01951 { 01952 return first>second ; 01953 } 01954 01955 INT32 XlongCmpGE( const xlong& first, const xlong& second) 01956 { 01957 return first>=second ; 01958 } 01959 01960 INT32 XlongCmpLT( const xlong& first, const xlong& second) 01961 { 01962 return first<second ; 01963 } 01964 01965 INT32 XlongCmpLE( const xlong& first, const xlong& second) 01966 { 01967 return first<=second ; 01968 } 01969 01970 INT32 XlongCmpEQ( const xlong& first, const xlong& second) 01971 { 01972 return first==second ; 01973 } 01974 01975 INT32 XlongCmpNE( const xlong& first, const xlong& second) 01976 { 01977 return first!=second ; 01978 } 01979 01980 /******************************************************************************************** 01981 01982 > void XlongIncrement( xlong& input ) 01983 01984 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 01985 Created: 29/4/93 01986 Scope: Private to Xlong class 01987 Inputs: 64-bit signed xlong 01988 Outputs: 64-bit signed xlong 01989 Returns: none 01990 Purpose: Private to ccmath.cpp. Primitive for operator overloading. This is 01991 much more efficient than calling Add with a 1 as a second parameter. 01992 Errors: None (overflow ignored). 01993 01994 ********************************************************************************************/ 01995 01996 void XlongIncrement( xlong& input ) 01997 { 01998 input++ ; 01999 } 02000 02001 /******************************************************************************************** 02002 02003 > void XlongDecrement( xlong& input ) 02004 02005 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 02006 Created: 29/4/93 02007 Scope: Private to Xlong class 02008 Inputs: 64-bit signed xlong 02009 Outputs: 64-bit signed xlong 02010 Returns: none 02011 Purpose: Private to ccmath.cpp. Primitive for operator overloading. This is 02012 much more efficient than calling Sub with a 1 as a second parameter. 02013 Errors: None (underflow ignored). 02014 02015 ********************************************************************************************/ 02016 02017 void XlongDecrement( xlong& input ) 02018 { 02019 input-- ; 02020 } 02021 02022 /******************************************************************************************** 02023 02024 > void XDiv64( xlong& top, xlong& bottom, xlong& result ) 02025 02026 > void XDiv64One( xlong &bottom, xlong &result) 02027 02028 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 02029 Created: 30/4/93 02030 Scope: Private to Xlong class 02031 Inputs: two 64-bit signed xlong 02032 Outputs: 64-bit signed xlong 02033 Returns: none 02034 Purpose: Private to ccmath.cpp. Primitive for operator overloading. 02035 Errors: None (underflow ignored). Div0 will take exception 02036 02037 ********************************************************************************************/ 02038 02039 void XDiv64( xlong& top, xlong& bottom, xlong& result ) 02040 { 02041 result = top/bottom ; 02042 } 02043 02044 void XDiv64One( xlong &bottom, xlong &result) 02045 { 02046 result /= bottom ; 02047 } 02048 02049 /******************************************************************************************** 02050 02051 > void XlongToAscii( const xlong& arg, LPSTR dest ) 02052 02053 > void XlongToUnicode( const xlong& arg, LPWORD dest ) 02054 02055 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 02056 Created: 5/5/93 02057 Scope: Private to Xlong class 02058 Inputs: 64-bit signed xlong 02059 Outputs: ASCII string, optional - sign then up to 20 digits, then null byte 02060 Returns: none 02061 Purpose: Display xlongs in meaningful format 02062 Errors: None 02063 02064 ********************************************************************************************/ 02065 02066 void XlongToAscii( const xlong& arg, LPSTR dest ) 02067 { 02068 #if defined(__WXMSW__) 02069 sprintf(dest,"%I64i",arg) ; 02070 #else 02071 sprintf(dest,"%lld",arg) ; 02072 #endif 02073 } 02074 02075 void XlongToUnicode( const xlong& arg, WCHAR *dest ) 02076 { 02077 #if defined(__WXMSW__) 02078 swprintf( dest, 21, L"%I64i", arg ); 02079 #else 02080 swprintf( dest, 21, L"%lld", arg ); 02081 #endif 02082 } 02083 02084 /******************************************************************************************** 02085 02086 > Xlong XMatrixCalc( FIXED16 fix1, Xlong l1, FIXED16 fix2, Xlong l2, Xlong& result) 02087 02088 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 02089 Created: 30/5/93 02090 Scope: Private to Xlong class 02091 Inputs: two FIXED16s, two xlongs 02092 Outputs: Result returns modified. (32-bit version is a macro). 02093 Returns: Xlong result of fix1*l1 + fix2*l2 02094 Purpose: Matrix multiply primitive done using intermediate 128-bit results 02095 so full accuracy is maintained. Special cases are when fix1 or fix2 02096 are 0.0 or 1.0 as multiplications may be avoided (NOT YET IMPLEMENTED) 02097 Note that the result is rounded to the nearest integer. 02098 Errors: None (overflow ignored). 02099 02100 ********************************************************************************************/ 02101 02102 void XMatrixCalc( fixed16 fix1, const xlong& l1, fixed16 fix2, const xlong& l2, xlong& result ) 02103 { 02104 result = xlong(((double)l1*fix1.all+(double)l2*fix2.all)/(1<<16)) ; 02105 } 02106 02107 /******************************************************************************************** 02108 02109 > void XlongByFixed16One( Xlong* x1, FIXED16 fix) 02110 02111 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 02112 Created: 30/5/93 02113 Inputs: An Xlong (which will be modified) and a FIXED16. 02114 Outputs: None 02115 Returns: Xlong result of x1 * fix 02116 Purpose: Multiplying without losing precision. Private function used by 02117 operator overloading on *=. 02118 Errors: None (overflow ignored). 02119 Scope: Private 02120 02121 ********************************************************************************************/ 02122 02123 void XlongByFixed16One( xlong* x1, fixed16 fix ) 02124 { 02125 *x1 = xlong( ( (double)*x1 * fix.all ) / ( 1 << 16 ) ); 02126 } 02127 02128 /******************************************************************************************** 02129 02130 > double XlongToDouble( const Xlong& x ) 02131 02132 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 02133 Created: 10/6/93 02134 Inputs: An Xlong 02135 Outputs: None 02136 Returns: A double-precision value 02137 Purpose: Conversion between types. Private to ccmaths.h which has a better 02138 interface on top of this. 02139 Errors: None (overflow impossible, some precision may be lost) 02140 Scope: Private 02141 02142 ********************************************************************************************/ 02143 02144 double XlongToDouble( const xlong& x ) 02145 { 02146 return (double)x; 02147 } 02148 02149 /******************************************************************************************** 02150 02151 > void DoubleToXlong( const double, Xlong& ) 02152 02153 Author: Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com> 02154 Created: 10/6/93 02155 Inputs: A double for conversion and a reference to an xlong (for the return 02156 value). 02157 Outputs: Xlong reference is updated with new value 02158 Returns: None 02159 Purpose: Conversion between types. Private to ccmaths.h which has a better 02160 interface on top of this. 02161 Errors: None (overflow ignored). No rounding. (I think). 02162 Scope: Private 02163 02164 ********************************************************************************************/ 02165 02166 void DoubleToXlong( const double arg, xlong& x ) 02167 { 02168 x = (xlong)arg ; 02169 }