1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 #ifndef _TOOLS_HELPERS_HXX
10 #define _TOOLS_HELPERS_HXX
12 inline long MinMax( long nVal
, long nMin
, long nMax
)
14 return nVal
>= nMin
? ( nVal
<= nMax
? nVal
: nMax
) : nMin
;
17 inline long AlignedWidth4Bytes( long nWidthBits
)
19 return ( ( nWidthBits
+ 31 ) >> 5 ) << 2;
22 inline long FRound( double fVal
)
24 return fVal
> 0.0 ? static_cast<long>( fVal
+ 0.5 ) : -static_cast<long>( -fVal
+ 0.5 );
29 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */