Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 : #ifndef _TOOLS_HELPERS_HXX
10 : #define _TOOLS_HELPERS_HXX
11 :
12 1100 : inline long MinMax( long nVal, long nMin, long nMax )
13 : {
14 1100 : return nVal >= nMin ? ( nVal <= nMax ? nVal : nMax ) : nMin;
15 : }
16 :
17 17 : inline long AlignedWidth4Bytes( long nWidthBits )
18 : {
19 17 : return ( ( nWidthBits + 31 ) >> 5 ) << 2;
20 : }
21 :
22 36418 : inline long FRound( double fVal )
23 : {
24 36418 : return fVal > 0.0 ? static_cast<long>( fVal + 0.5 ) : -static_cast<long>( -fVal + 0.5 );
25 : }
26 :
27 : #endif
28 :
29 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|