fixed16.cpp

Go to the documentation of this file.
00001 // $Id: fixed16.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 #include "camtypes.h"
00101 //#include "fixed16.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00102 
00103 DECLARE_SOURCE("$Revision: 1282 $");
00104 
00105 /********************************************************************************************
00106 >   void FIXED16::ToString(StringBase* out) const 
00107 
00108     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00109     Created:    2/6/93 - rewritten in C 12/8/93 by Andy - rewritten so it works: JCF 31/10/94
00110     Inputs:     None.
00111     Outputs:    Returns a string representing the value of a FIXED16 in the 'out' parameter.
00112                 Optional - sign, up to five digits of integer, then option period and five
00113                 fractional digits then zero terminator (max 13 character result)
00114     Returns:    -
00115     Purpose:    Converts value of FIXED16 into a string representing it. The string will be
00116                 ASCII or Unicode depending on the size of TCHAR
00117     Errors:     -
00118 ********************************************************************************************/
00119 
00120 void fixed16::ToString(StringBase* pOut) const
00121 {
00122     // Allocate some working storage etc.
00123     TCHAR buf[32];
00124     TCHAR* pch = buf;
00125     INT32 n = all;
00126 
00127     // If the number is negative then output a sign and make it positive.
00128     if (n < 0)
00129     {
00130         *pch++ = TEXT('-');
00131         n = -n;
00132     }
00133 
00134     // Convert and output the integer part of the number.
00135     pch += camSnprintf( pch, 256, TEXT("%u"), unsigned(n >> F16SHIFT) );
00136 
00137     // Mask off the fractional part, converting it if it exists.
00138     n &= (1uL << F16SHIFT) - 1;
00139     if (n != 0)
00140     {
00141         // Output a decimal point.
00142         *pch++ = TEXT('.');
00143 
00144         // "Normalise" into an integer by multiplying by 100000/65336.
00145         n = MulDiv32By32(n, 100000L, 65536L);
00146 
00147         // Convert and output.  We must do this ourselves as we must take
00148         // account of leading zeros.
00149         INT32 nPowerTen = 10000L;
00150         while (nPowerTen > 0)
00151         {
00152             // Is the remaining part of the number greater than our power of ten?
00153             if (n >= nPowerTen)
00154             {
00155                 // Output a non-zero digit and subtract the closest multiple of the
00156                 // power of ten.
00157                 INT32 nFactor = n / nPowerTen;
00158                 *pch++ = TEXT('0') + TCHAR(nFactor);
00159                 n -= (n * nFactor);
00160             }
00161             else
00162             {
00163                 // Output a leading zero.
00164                 *pch++ = TEXT('0');
00165             }
00166 
00167             // Go on to the next highest power of ten.
00168             nPowerTen /= 10;
00169         }
00170     }
00171 
00172     // Terminate and write into the output parameter.
00173     *pch = TEXT('\0');
00174     *pOut = buf;
00175 }
00176 
00177 
00178 
00179 
00180 // Friend Functions - Basic Operators
00181 /********************************************************************************************
00182 
00183 >   FIXED16_DBL(d) 
00184 
00185     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00186     Created:    10/6/93
00187     Inputs:     double.
00188     Outputs:    None
00189     Returns:    FIXED16.
00190     Purpose:    
00191         This macro converts constant doubles into FIXED16s at compile time. It is 
00192         very effecient because there is no runtime overhead unlike normal conversion.  
00193         
00194     Errors:     None.
00195 
00196 ********************************************************************************************/
00197 
00198 /********************************************************************************************
00199 
00200 >   inline FIXED16::FIXED16 () 
00201 
00202     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00203     Created:    27/4/93
00204     Inputs:     None
00205     Outputs:    None
00206     Returns:    None.
00207     Purpose:    Default constructor for FIXED16. It does not actually do anything!
00208     Errors:     None.
00209 
00210 ********************************************************************************************/
00211 
00212 // actual (null) function can be found in class
00213 
00214 /********************************************************************************************
00215 
00216 >   inline FIXED16::FIXED16 (const FIXED16&) 
00217 
00218     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00219     Created:    27/4/93
00220     Inputs:     None
00221     Outputs:    None
00222     Returns:    None.
00223     Purpose:    Copy constructor.
00224     Errors:     None.
00225 
00226 ********************************************************************************************/
00227 
00228 /********************************************************************************************
00229 
00230 >   inline FIXED16::FIXED16 (INT32) 
00231 
00232     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00233     Created:    27/4/93
00234     Inputs:     None
00235     Outputs:    None
00236     Returns:    None.
00237     Purpose:    Constructor.
00238     Errors:     None.
00239 
00240 ********************************************************************************************/
00241 
00242 /********************************************************************************************
00243 
00244 >   inline FIXED16::FIXED16 (short) 
00245 
00246     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00247     Created:    27/4/93
00248     Inputs:     None
00249     Outputs:    None
00250     Returns:    None.
00251     Purpose:    Constructor.
00252     Errors:     None.
00253 
00254 ********************************************************************************************/
00255 
00256 /********************************************************************************************
00257 
00258 >   inline FIXED16::FIXED16 (double) 
00259 
00260     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00261     Created:    2/6/93
00262     SeeAlso:    Fixedasm.h
00263     Inputs:     None
00264     Outputs:    None
00265     Returns:    None.
00266     Purpose:    Constructor.
00267     Errors:     None.
00268 
00269 ********************************************************************************************/
00270 
00271 /********************************************************************************************
00272 
00273 >   inline FIXED16 FIXED16::FromRawLong(INT32 d) 
00274 
00275     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00276     Created:    2/6/93
00277     Inputs:     None
00278     Outputs:    None
00279     Returns:    None.
00280     Scope:      Private - is only used to implement FIXED16_DBL macro. Do not call directly!
00281     Purpose:    converts a INT32 to a FIXED16.
00282     Errors:     None.
00283     See Also:   Fixed16::FromShifted16
00284 
00285 This function returns the fixed16 associated with the machine implementation representation of
00286 the number passed in. Andy claims this may not be the same on all platforms, so this is the OIL
00287 dependent way to get the internal representation. Compare and contrast FromShifted16 which does
00288 the same thing on this platform.
00289 
00290 This is intended for serialisation (not maths use), and also for the FIXED16_DBL macro.
00291 
00292 ********************************************************************************************/
00293 
00294 /********************************************************************************************
00295 
00296 >   inline FIXED16 FIXED16::FromShifted16(INT32 d) 
00297 
00298     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00299     Created:    25/11/93
00300     Inputs:     None
00301     Outputs:    None
00302     Returns:    None.
00303     Scope:      Public
00304     Purpose:    converts a INT32 to a FIXED16.
00305     Errors:     None.
00306     See Also:   Fixed16::FromShifted16
00307 
00308 This function returns the fixed 16 number which is the INT32 shifted down 16 places as a INT32,
00309 i.e. divided by (2^16). Andy claims the internal representation may not be the same on all
00310 platforms, so while FromRawLong() takes the internal representation, this is a platform
00311 independent way of setting the 'meaning' of the fixed16, i.e. what you would get if you
00312 divided the INT32 by 2^16. On this platform, it's the same as GetRawLong().
00313 
00314 This is intended for maths use (not serialisation).
00315 
00316 ********************************************************************************************/
00317 
00318 /********************************************************************************************
00319 
00320 >   inline INT32 FIXED16::MakeInt() const 
00321 
00322     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00323     Created:    2/6/93
00324     Inputs:     None
00325     Outputs:    None
00326     Returns:    None.
00327     Purpose:    converts a FIXED16 to an integer.
00328     Errors:     None.
00329 
00330 ********************************************************************************************/
00331 
00332 /********************************************************************************************
00333 
00334 >   inline short FIXED16::MakeShort() const 
00335 
00336     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00337     Created:    2/6/93
00338     SeeAlso:    Fixedasm.h
00339     Inputs:     None
00340     Outputs:    None
00341     Returns:    None.
00342     Purpose:    converts a FIXED16 to an integer.
00343     Errors:     None.
00344 
00345 ********************************************************************************************/
00346 
00347 /********************************************************************************************
00348 
00349 >   inline INT32 FIXED16::MakeLong() const
00350 
00351     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00352     Created:    2/6/93
00353     Inputs:     None
00354     Outputs:    None
00355     Returns:    None.
00356     Purpose:    converts a FIXED16 to a INT32.
00357     Errors:     None.
00358 
00359 ********************************************************************************************/
00360 
00361 /********************************************************************************************
00362 
00363 >   inline XLONG FIXED16::MakeXlong() const
00364 
00365     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00366     Created:    2/6/93
00367     Inputs:     None
00368     Outputs:    None
00369     Returns:    None.
00370     Purpose:    converts a FIXED16 to a INT32.
00371     Errors:     None.
00372 
00373 ********************************************************************************************/
00374 
00375 /********************************************************************************************
00376 
00377 >   inline FIXED16& operator= (const FIXED16& operand) 
00378 
00379     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00380     Created:    27/4/93
00381     Inputs:     operand to be  assigned - rhs of assignment.
00382     Outputs:    None.
00383     Returns:    A reference to an FIXED16 with result of assignment.
00384     Purpose:    Overloading the assignment operator for FIXED16s.
00385     Errors:     None.
00386 
00387 ********************************************************************************************/
00388 
00389 /********************************************************************************************
00390 
00391 >   inline double FIXED16::MakeDouble() const
00392 
00393     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00394     Created:    7/6/93
00395     SeeAlso:    fixedasm.h
00396     Inputs:     None
00397     Outputs:    None
00398     Returns:    double. 
00399     Purpose:    Makes a double (32-bit signed value) out of a fixed point 16-bit value.
00400     Errors:     None.
00401 
00402 ********************************************************************************************/
00403 
00404 /********************************************************************************************
00405 
00406 >   inline FIXED16& operator= (const short operand) 
00407 
00408     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00409     Created:    27/4/93
00410     SeeAlso:    Fixedasm.h
00411     Inputs:     operand to be  assigned - rhs of assignment.
00412     Outputs:    None.
00413     Returns:    A reference to an FIXED16 with result of assignment.
00414     Purpose:    Overloading the assignment operator for FIXED16s.
00415     Errors:     None.
00416 
00417 ********************************************************************************************/
00418 
00419 /********************************************************************************************
00420 
00421 >   inline INT32 fixed16::GetRawLong() const
00422 
00423     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00424     Created:    24/5/94
00425     Inputs:     -
00426     Outputs:    -
00427     Returns:    The longword that holds the whole value, i.e. the value <<16.
00428     Purpose:    Very efficient way of getting an entire longword. Use sparingly.
00429     Errors:     fixed16::GetShifted16()
00430 
00431 This function returns the machine implementation representation of the number. Andy claims
00432 this may not be the same on all platforms, so this is the OIL dependent way to get the internal
00433 representation. Compare and contrast GetShifted16 which does the same thing on this platform.
00434 
00435 This is intended for serialisation (not maths use).
00436 
00437 ********************************************************************************************/
00438 
00439 /********************************************************************************************
00440 
00441 >   inline INT32 fixed16::GetShifted16() const
00442 
00443     Author:     Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
00444     Created:    22/11/94
00445     Inputs:     -
00446     Outputs:    -
00447     Returns:    The value <<16.
00448     Purpose:    Efficient way to get the value shifted 16 places
00449     Errors:     None.
00450     See Also:   fixed16::GetRawLong
00451 
00452 This function returns the fixed 16 number shifted up 16 places as a INT32, i.e. when multiplied.
00453 by (2^16). Andy claims the internal representation may not be the same on all platforms, so 
00454 while GetRawLong() returns the internal representation, this is a platform independent way
00455 of returning the 'meaning' of the fixed16, i.e. what you would get if you multiplied it by
00456 2^16. On this platform, it's the same as GetRawLong().
00457 
00458 This is intended for maths use (not serialisation).
00459 
00460 ********************************************************************************************/
00461 
00462 /********************************************************************************************
00463 
00464 >   inline FIXED16 FIXED16::trunc() const
00465 
00466     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00467     Created:    10/8/94
00468     Inputs:     Reference to a FIXED16.
00469     Outputs:    None.
00470     Returns:    The integer part of the input FIXED16.
00471     Purpose:    Take the integer part of FIXED16s.
00472     Errors:     None.
00473 
00474 ********************************************************************************************/
00475 
00476 /********************************************************************************************
00477 
00478 >   inline FIXED16 FIXED16::round() const
00479 
00480     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00481     Created:    10/8/94
00482     Inputs:     Reference to a FIXED16.
00483     Outputs:    None.
00484     Returns:    The closest integer to the input FIXED16.
00485     Purpose:    Find the closest integer to a FIXED16s.
00486     Errors:     None.
00487 
00488 ********************************************************************************************/
00489 
00490 /********************************************************************************************
00491 
00492 >   inline FIXED16 FIXED16::abs() const
00493 
00494     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00495     Created:    10/8/94
00496     Inputs:     Reference to a FIXED16.
00497     Outputs:    None.
00498     Returns:    The positive value of the input FIXED16.
00499     Purpose:    Find the absolute value (magnitude) of a FIXED16.
00500     Errors:     None.
00501 
00502 ********************************************************************************************/
00503 
00504 /********************************************************************************************
00505 
00506 >   inline FIXED16 FIXED16::sgn() const
00507 
00508     Author:     Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
00509     Created:    10/8/94
00510     Inputs:     Reference to a FIXED16.
00511     Outputs:    None.
00512     Returns:    +1 if the input FIXED 16 was positive or 0, -1 if the input was negative.
00513     Purpose:    Find the sign of a FIXED16.
00514                 Note the difference between this and BASIC SGN functions: This one returns
00515                 1 when the input value is zero!
00516     Errors:     None.
00517 
00518 ********************************************************************************************/
00519 
00520 /********************************************************************************************
00521 
00522 >   FIXED16 operator+ (const FIXED16& operand1, const FIXED16& operand2) 
00523 
00524     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00525     Created:    27/4/93
00526     Friend:     FIXED16
00527     Inputs:     Two values to be added together.
00528     Outputs:    None.
00529     Returns:    A FIXED16 with result of addition.
00530     Purpose:    Overloading the addition operator for FIXED16s.
00531     Errors:     None.
00532 
00533 NB - inline
00534 
00535 ********************************************************************************************/
00536 
00537 /********************************************************************************************
00538 
00539 >   FIXED16 operator- (const FIXED16& operand1, const FIXED16& operand2) 
00540 
00541     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00542     Created:    27/4/93
00543     Friend:     FIXED16
00544     Inputs:     Two values to be subtracted from each other.
00545     Outputs:    None.
00546     Returns:    A FIXED16 with result of subtraction.
00547     Purpose:    Overloading the subtract operator for FIXED16s.
00548     Errors:     None.
00549 
00550 NB - inline
00551 
00552 ********************************************************************************************/
00553 
00554 /********************************************************************************************
00555 
00556 >   FIXED16 operator- (const FIXED16& operand1)
00557 
00558     Author:     Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
00559     Created:    30/5/93
00560     Friend:     FIXED16
00561     Inputs:     A value to be negated.
00562     Outputs:    None.
00563     Returns:    A FIXED16 with result of negation.
00564     Purpose:    Overloading the negation operator for FIXED16s. Should be inline.
00565     Errors:     None.
00566 
00567 ********************************************************************************************/
00568 
00569 /********************************************************************************************
00570 
00571 >   FIXED16 operator* (const FIXED16& operand1, const FIXED16& operand2) 
00572 
00573     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00574     Created:    27/4/93
00575     SeeAlso:    Fixed16Mul().
00576     Friend:     FIXED16
00577     Inputs:     Two values to be multiplied togther.
00578     Outputs:    None.
00579     Returns:    A FIXED16 with result of multiplication.
00580     Purpose:    Overloading the multiplication operator for FIXED16s.
00581     Errors:     None.
00582 
00583 ********************************************************************************************/
00584 
00585 /********************************************************************************************
00586 
00587 >   FIXED16 operator/ (const FIXED16& operand1, const FIXED16& operand2) 
00588 
00589     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00590     Created:    27/4/93
00591     SeeAlso:    Fixed16Div().
00592     Friend:     FIXED16
00593     Inputs:     Two values to be divided.
00594     Outputs:    None.
00595     Returns:    A FIXED16 with result of division.
00596     Purpose:    Overloading the division operator for FIXED16s.
00597     Errors:     None.
00598 
00599 ********************************************************************************************/
00600 
00601 /********************************************************************************************
00602 
00603 >   FIXED16 operator>> (const FIXED16& operand1, UINT32 operand2) 
00604 
00605     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00606     Created:    27/4/93
00607     Friend:     FIXED16
00608     Inputs:     operand1 - value to be shifted.
00609                 operand2 - shift count.
00610     Outputs:    None.
00611     Returns:    A reference to an FIXED16 with result of ASR.
00612     Purpose:    Overloading the >> operator to mean shift right for FIXED16s.
00613     Errors:     None.
00614 
00615 ********************************************************************************************/
00616 
00617 /********************************************************************************************
00618 
00619 >   FIXED16 operator<< (const FIXED16& operand1, UINT32 operand2) 
00620 
00621     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00622     Created:    27/4/93
00623     Friend:     FIXED16
00624     Inputs:     operand1 - value to be shifted.
00625                 operand2 - shift count.
00626     Outputs:    None.
00627     Returns:    A reference to an FIXED16 with result of ASL.
00628     Purpose:    Overloading the << operator to mean shift left for FIXED16s.
00629     Errors:     None.
00630 
00631 ********************************************************************************************/
00632 
00633 /********************************************************************************************
00634 
00635 >   INT32 operator== (const FIXED16& operand1, const FIXED16& operand2) 
00636 
00637     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00638     Created:    5/5/93
00639     Friend:     FIXED16
00640     Inputs:     Two FIXED16s to be compared.
00641     Outputs:    None.
00642     Returns:    0 - False
00643                 1 - True
00644     Purpose:    Overloading the equality operator for FIXED16s.
00645     Errors:     None.
00646 
00647 ********************************************************************************************/
00648 
00649 /********************************************************************************************
00650 
00651 >   INT32 operator== (const FIXED16& operand1, const short operand2) 
00652 
00653     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00654     Created:    2/6/93
00655     Friend:     FIXED16
00656     Inputs:     FIXED16
00657                 INT8
00658     Outputs:    None.
00659     Returns:    0 - False
00660                 1 - True
00661     Purpose:    Overloading the equality operator for FIXED16s.
00662     Errors:     None.
00663 
00664 ********************************************************************************************/
00665 
00666 /********************************************************************************************
00667 
00668 >   INT32 operator!= (const FIXED16& operand1, const FIXED16& operand2) 
00669 
00670     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00671     Created:    5/5/93
00672     Friend:     FIXED16
00673     Inputs:     Two FIXED16s to be compared.
00674     Outputs:    None.
00675     Returns:    0 - False
00676                 1 - True
00677     Purpose:    Overloading the inequality operator for FIXED16s.
00678     Errors:     None.
00679 
00680 ********************************************************************************************/
00681 
00682 /********************************************************************************************
00683 
00684 >   INT32 operator!= (const FIXED16& operand1, const short operand2) 
00685 
00686     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00687     Created:    5/5/93
00688     Friend:     FIXED16
00689     Inputs:     FIXED16
00690                 short
00691     Outputs:    None.
00692     Returns:    0 - False
00693                 1 - True
00694     Purpose:    Overloading the inequality operator for FIXED16s.
00695     Errors:     None.
00696 
00697 ********************************************************************************************/
00698 
00699 /********************************************************************************************
00700 
00701 >   INT32 operator> (const FIXED16& operand1, const FIXED16& operand2) 
00702 
00703     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00704     Created:    5/5/93
00705     Friend:     FIXED16
00706     Inputs:     Two FIXED16s to be compared.
00707     Outputs:    None.
00708     Returns:    0 - False
00709                 1 - True
00710     Purpose:    Overloading the greater-than operator for FIXED16s.
00711     Errors:     None.
00712 
00713 ********************************************************************************************/
00714 
00715 /********************************************************************************************
00716 
00717 >   INT32 operator> (const FIXED16& operand1, const short operand2) 
00718 
00719     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00720     Created:    5/5/93
00721     Friend:     FIXED16
00722     Inputs:     FIXED16
00723                 short
00724     Outputs:    None.
00725     Returns:    0 - False
00726                 1 - True
00727     Purpose:    Overloading the greater-than operator for FIXED16s.
00728     Errors:     None.
00729 
00730 ********************************************************************************************/
00731 
00732 /********************************************************************************************
00733 
00734 >   INT32 operator< (const FIXED16& operand1, const FIXED16& operand2) 
00735 
00736     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00737     Created:    5/5/93
00738     Friend:     FIXED16
00739     Inputs:     Two FIXED16s to be compared.
00740     Outputs:    None.
00741     Returns:    0 - False
00742                 1 - True
00743     Purpose:    Overloading the less-than operator for FIXED16s.
00744     Errors:     None.
00745 
00746 ********************************************************************************************/
00747 
00748 /********************************************************************************************
00749 
00750 >   INT32 operator< (const FIXED16& operand1, const short operand2) 
00751 
00752     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00753     Created:    5/5/93
00754     Friend:     FIXED16
00755     Inputs:     FIXED16
00756                 short
00757     Outputs:    None.
00758     Returns:    0 - False
00759                 1 - True
00760     Purpose:    Overloading the less-than operator for FIXED16s.
00761     Errors:     None.
00762 
00763 ********************************************************************************************/
00764 
00765 /********************************************************************************************
00766 
00767 >   INT32 operator>= (const FIXED16& operand1, const FIXED16& operand2) 
00768 
00769     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00770     Created:    5/5/93
00771     Friend:     FIXED16
00772     Inputs:     Two FIXED16s to be compared.
00773     Outputs:    None.
00774     Returns:    0 - False
00775                 1 - True
00776     Purpose:    Overloading the greater-than-equal-to operator for FIXED16s.
00777     Errors:     None.
00778 
00779 ********************************************************************************************/
00780 
00781 /********************************************************************************************
00782 
00783 >   INT32 operator>= (const FIXED16& operand1, const short operand2) 
00784 
00785     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00786     Created:    5/5/93
00787     Friend:     FIXED16
00788     Inputs:     FIXED16
00789                 short
00790     Outputs:    None.
00791     Returns:    0 - False
00792                 1 - True
00793     Purpose:    Overloading the greater-than-equal-to operator for FIXED16s.
00794     Errors:     None.
00795 
00796 ********************************************************************************************/
00797 
00798 /********************************************************************************************
00799 
00800 >   INT32 operator<= (const FIXED16& operand1, const FIXED16& operand2) 
00801 
00802     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00803     Created:    5/5/93
00804     Friend:     FIXED16
00805     Inputs:     Two FIXED16s to be compared.
00806     Outputs:    None.
00807     Returns:    0 - False
00808                 1 - True
00809     Purpose:    Overloading the less-than-equal-to operator for FIXED16s.
00810     Errors:     None.
00811 
00812 ********************************************************************************************/
00813 
00814 /********************************************************************************************
00815 
00816 >   INT32 operator<= (const FIXED16& operand1, const short operand2) 
00817 
00818     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00819     Created:    5/5/93
00820     Friend:     FIXED16
00821     Inputs:     FIXED16
00822                 short
00823     Outputs:    None.
00824     Returns:    0 - False
00825                 1 - True
00826     Purpose:    Overloading the less-than-equal-to operator for FIXED16s.
00827     Errors:     None.
00828 
00829 ********************************************************************************************/
00830 
00831 // Assignment operators
00832 
00833 /********************************************************************************************
00834 
00835 >   FIXED16& FIXED16::operator= (const INT32 operand) 
00836 
00837     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00838     Created:    27/4/93
00839     Inputs:     operand to be  assigned - rhs of assignment.
00840     Outputs:    None.
00841     Returns:    A reference to an FIXED16 with result of assignment.
00842     Purpose:    Overloading the assignment operator for FIXED16s.
00843     Errors:     None.
00844 
00845 ********************************************************************************************/
00846 
00847 /********************************************************************************************
00848 
00849 >   FIXED16& FIXED16::operator= (const double operand) 
00850 
00851     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00852     Created:    27/4/93
00853     SeeAlso:    DoubleToFixed16().
00854     Inputs:     operand to be  assigned - rhs of assignment.
00855     Outputs:    None.
00856     Returns:    A reference to an FIXED16 with result of assignment.
00857     Purpose:    Overloading the assignment operator for FIXED16s.
00858     Errors:     None.
00859 
00860 ********************************************************************************************/
00861 
00862 /********************************************************************************************
00863 
00864 >   FIXED16& FIXED16::operator+= (const FIXED16& operand) 
00865 
00866     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00867     Created:    27/4/93
00868     Inputs:     lvalue to be incremented
00869                 operand to be added - rhs of assignment.
00870     Outputs:    None.
00871     Returns:    A reference to an FIXED16 with result of assignment.
00872     Purpose:    Overloading the plus-equals operator for FIXED16s.
00873     Errors:     None.
00874 
00875 ********************************************************************************************/
00876 
00877 /********************************************************************************************
00878 
00879 >   FIXED16& FIXED16::operator+= (const short operand) 
00880 
00881     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00882     Created:    27/4/93
00883     Inputs:     lvalue to be incremented
00884                 operand to be added - rhs of assignment.
00885     Outputs:    None.
00886     Returns:    A reference to an FIXED16 with result of assignment.
00887     Purpose:    Overloading the plus-equals operator for FIXED16s.
00888     Errors:     None.
00889 
00890 ********************************************************************************************/
00891 
00892 /********************************************************************************************
00893 
00894 >   FIXED16& FIXED16::operator-= (const FIXED16& operand) 
00895 
00896     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00897     Created:    27/4/93
00898     Inputs:     lvalue to be decremented
00899                 operand to be subtracted - rhs of assignment.
00900     Outputs:    None.
00901     Returns:    A reference to an FIXED16 with result of assignment.
00902     Purpose:    Overloading the minus-equals operator for FIXED16s.
00903     Errors:     None.
00904 
00905 ********************************************************************************************/
00906 
00907 /********************************************************************************************
00908 
00909 >   FIXED16& FIXED16::operator-= (const short operand) 
00910 
00911     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00912     Created:    27/4/93
00913     Inputs:     lvalue to be decremented
00914                 operand to be subtracted - rhs of assignment.
00915     Outputs:    None.
00916     Returns:    A reference to an FIXED16 with result of assignment.
00917     Purpose:    Overloading the minus-equals operator for FIXED16s.
00918     Errors:     None.
00919 
00920 ********************************************************************************************/
00921 
00922 /********************************************************************************************
00923 
00924 >   FIXED16& FIXED16::operator*= (const FIXED16& operand) 
00925 
00926     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00927     Created:    27/4/93
00928     SeeAlso:    Fixed16Mul().
00929     Inputs:     lvalue to be multiplied
00930                 multiplier - rhs of assignment.
00931     Outputs:    None.
00932     Returns:    A reference to an FIXED16 with result of assignment.
00933     Purpose:    Overloading the times-equals operator for FIXED16s.
00934     Errors:     None.
00935 
00936 ********************************************************************************************/
00937  
00938 /********************************************************************************************
00939 
00940 >   FIXED16& FIXED16::operator*= (const short operand) 
00941 
00942     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00943     Created:    27/4/93
00944     SeeAlso:    Fixed16Mul().
00945     Inputs:     lvalue to be multiplied
00946                 multiplier - rhs of assignment.
00947     Outputs:    None.
00948     Returns:    A reference to an FIXED16 with result of assignment.
00949     Purpose:    Overloading the times-equals operator for FIXED16s.
00950     Errors:     None.
00951 
00952 ********************************************************************************************/
00953  
00954 /********************************************************************************************
00955 
00956 >   FIXED16& FIXED16::operator/= (const FIXED16& operand) 
00957 
00958     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00959     Created:    27/4/93
00960     SeeAlso:    Fixed16Div().
00961     Inputs:     lvalue to be divided
00962                 divisor - rhs of assignment.
00963     Outputs:    None.
00964     Returns:    A reference to an FIXED16 with result of assignment.
00965     Purpose:    Overloading the divide-equals operator for FIXED16s.
00966     Errors:     None.
00967 
00968 ********************************************************************************************/
00969  
00970 /********************************************************************************************
00971 
00972 >   FIXED16& FIXED16::operator/= (const short operand) 
00973 
00974     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00975     Created:    27/4/93
00976     SeeAlso:    Fixed16Div().
00977     Inputs:     lvalue to be divided
00978                 divisor - rhs of assignment.
00979     Outputs:    None.
00980     Returns:    A reference to an FIXED16 with result of assignment.
00981     Purpose:    Overloading the divide-equals operator for FIXED16s.
00982     Errors:     None.
00983 
00984 ********************************************************************************************/
00985  
00986 /********************************************************************************************
00987 
00988 >   FIXED16& FIXED16::operator<<= (const UINT32 operand) 
00989 
00990     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
00991     Created:    27/4/93
00992     Inputs:     lvalue to be shifted
00993                 shift count - rhs of assignment.
00994     Outputs:    None.
00995     Returns:    A reference to an FIXED16 with result of assignment.
00996     Purpose:    Overloading the left-shift-equals operator for FIXED16s.
00997     Errors:     None.
00998 
00999 ********************************************************************************************/
01000  
01001 /********************************************************************************************
01002 
01003 >   FIXED16& FIXED16::operator>>= (const UINT32 operand) 
01004 
01005     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
01006     Created:    27/4/93
01007     Inputs:     lvalue to be shifted
01008                 shift count - rhs of assignment.
01009     Outputs:    None.
01010     Returns:    A reference to an FIXED16 with result of assignment.
01011     Purpose:    Overloading the right-shift-equals operator for FIXED16s.
01012     Errors:     None.
01013 
01014 ********************************************************************************************/
01015   
01016 // Increment FIXED16::operators
01017 
01018 /********************************************************************************************
01019 
01020 >   FIXED16& FIXED16::operator++ () 
01021 
01022     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
01023     Created:    27/4/93
01024     Inputs:     None.
01025     Outputs:    None.
01026     Returns:    A reference to an FIXED16 with result of increment.
01027     Purpose:    Overloading the prefix plus-plus operator for FIXED16s.
01028     Errors:     None.
01029 
01030 ********************************************************************************************/
01031   
01032 /********************************************************************************************
01033 
01034 >   FIXED16 FIXED16::operator++ (INT32 dummy) 
01035 
01036     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
01037     Created:    27/4/93
01038     Inputs:     dummy value to distinguish between pre- and post-fix application.
01039     Outputs:    None.
01040     Returns:    A reference to an FIXED16 with result of increment.
01041     Purpose:    Overloading the postfix plus-plus operator for FIXED16s.
01042     Errors:     None.
01043 
01044 ********************************************************************************************/
01045   
01046 /********************************************************************************************
01047 
01048 >   FIXED16& FIXED16::operator-- () 
01049 
01050     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
01051     Created:    27/4/93
01052     Inputs:     None.
01053     Outputs:    None.
01054     Returns:    A reference to an FIXED16 with result of decrement.
01055     Purpose:    Overloading the prefix minus-minus operator for FIXED16s.
01056     Errors:     None.
01057 
01058 ********************************************************************************************/
01059   
01060 /********************************************************************************************
01061 
01062 >   FIXED16 FIXED16::operator-- (INT32 dummy) 
01063 
01064     Author:     Mario_Shamtani (Xara Group Ltd) <camelotdev@xara.com>
01065     Created:    27/4/93
01066     Inputs:     dummy value to distinguish between pre- and post-fix application.
01067     Outputs:    None.
01068     Returns:    A reference to an FIXED16 with result of decrement.
01069     Purpose:    Overloading the postfix minus-minus operator for FIXED16s.
01070     Errors:     None.
01071 
01072 ********************************************************************************************/
01073 

Generated on Sat Nov 10 03:45:20 2007 for Camelot by  doxygen 1.4.4