1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsAlgorithm_h___
8 #define nsAlgorithm_h___
11 #include "mozilla/Assertions.h"
13 // We use these instead of std::min/max because we can't include the algorithm
14 // header in all of XPCOM because the stl wrappers will error out when included
15 // in parts of XPCOM. These functions should never be used outside of XPCOM.
17 inline const T
& XPCOM_MIN(const T
& aA
, const T
& aB
) {
18 return aB
< aA
? aB
: aA
;
21 // Must return b when a == b in case a is -0
23 inline const T
& XPCOM_MAX(const T
& aA
, const T
& aB
) {
24 return aA
> aB
? aA
: aB
;
27 #endif // !defined(nsAlgorithm_h___)