michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsSMILTimeValue.h" michael@0: michael@0: nsSMILTime nsSMILTimeValue::kUnresolvedMillis = INT64_MAX; michael@0: michael@0: //---------------------------------------------------------------------- michael@0: // nsSMILTimeValue methods: michael@0: michael@0: static inline int8_t michael@0: Cmp(int64_t aA, int64_t aB) michael@0: { michael@0: return aA == aB ? 0 : (aA > aB ? 1 : -1); michael@0: } michael@0: michael@0: int8_t michael@0: nsSMILTimeValue::CompareTo(const nsSMILTimeValue& aOther) const michael@0: { michael@0: int8_t result; michael@0: michael@0: if (mState == STATE_DEFINITE) { michael@0: result = (aOther.mState == STATE_DEFINITE) michael@0: ? Cmp(mMilliseconds, aOther.mMilliseconds) michael@0: : -1; michael@0: } else if (mState == STATE_INDEFINITE) { michael@0: if (aOther.mState == STATE_DEFINITE) michael@0: result = 1; michael@0: else if (aOther.mState == STATE_INDEFINITE) michael@0: result = 0; michael@0: else michael@0: result = -1; michael@0: } else { michael@0: result = (aOther.mState != STATE_UNRESOLVED) ? 1 : 0; michael@0: } michael@0: michael@0: return result; michael@0: }