1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sbxvals.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_basic.hxx"
34 #define _TLBIGINT_INT64
35 #include <tools/bigint.hxx>
36 #include <basic/sbx.hxx>
38 ///////////////////////////// BigInt/Currency //////////////////////////////
40 SbxValues::SbxValues( const BigInt
&rBig
) : eType(SbxCURRENCY
)
42 rBig
.INT64( &nLong64
);
45 //TODO: BigInt is TOOLS_DLLPUBLIC, and its four member functions only declared
46 // and defined within basic (#define _TLBIGINT_INT64) are a bad hack that causes
47 // "warning C4273: 'function' : inconsistent dll linkage" on MSC; this whole
48 // mess should be cleaned up properly (e.g., by completely removing Sbx[U]INT64
49 // and using sal_[u]Int64 instead):
51 #pragma warning(disable: 4273)
54 BOOL
BigInt::INT64( SbxINT64
*p
) const
57 if( nLen
> 4 || (nNum
[3] & 0x8000) )
60 p
->nLow
= ((UINT32
)nNum
[1] << 16) | (UINT32
)nNum
[0];
61 p
->nHigh
= ((UINT32
)nNum
[3] << 16) | (UINT32
)nNum
[2];
66 p
->Set( (INT32
)nVal
);
71 BigInt::BigInt( const SbxINT64
&r
)
73 BigInt a10000
= 0x10000;
78 *this += (USHORT
)(r
.nLow
>> 16);
80 *this += (USHORT
)r
.nLow
;
83 BOOL
BigInt::UINT64( SbxUINT64
*p
) const
86 if( bIsNeg
|| nLen
> 4 )
89 p
->nLow
= ((UINT32
)nNum
[1] << 16) | (UINT32
)nNum
[0];
90 p
->nHigh
= ((UINT32
)nNum
[3] << 16) | (UINT32
)nNum
[2];
96 p
->Set( (UINT32
)nVal
);
102 BigInt::BigInt( const SbxUINT64
&r
)
104 BigInt a10000
= 0x10000;
106 *this = BigInt(r
.nHigh
);
109 *this += (USHORT
)(r
.nLow
>> 16);
111 *this += (USHORT
)r
.nLow
;