Line data Source code
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/. */
6 :
7 : #include "nsSMILTimeValue.h"
8 :
9 : const nsSMILTime nsSMILTimeValue::kUnresolvedMillis = INT64_MAX;
10 :
11 : //----------------------------------------------------------------------
12 : // nsSMILTimeValue methods:
13 :
14 : static inline int8_t
15 0 : Cmp(int64_t aA, int64_t aB)
16 : {
17 0 : return aA == aB ? 0 : (aA > aB ? 1 : -1);
18 : }
19 :
20 : int8_t
21 0 : nsSMILTimeValue::CompareTo(const nsSMILTimeValue& aOther) const
22 : {
23 : int8_t result;
24 :
25 0 : if (mState == STATE_DEFINITE) {
26 0 : result = (aOther.mState == STATE_DEFINITE)
27 0 : ? Cmp(mMilliseconds, aOther.mMilliseconds)
28 0 : : -1;
29 0 : } else if (mState == STATE_INDEFINITE) {
30 0 : if (aOther.mState == STATE_DEFINITE)
31 0 : result = 1;
32 0 : else if (aOther.mState == STATE_INDEFINITE)
33 0 : result = 0;
34 : else
35 0 : result = -1;
36 : } else {
37 0 : result = (aOther.mState != STATE_UNRESOLVED) ? 1 : 0;
38 : }
39 :
40 0 : return result;
41 : }
|