Sha256: 6a96e3fb356dc8f067411d5594f17efaeb3936d020f3388db75077340af4d338

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

/*
 *  Main authors:
 *     Christian Schulte <schulte@gecode.org>
 *
 *  Copyright:
 *     Christian Schulte, 2003
 *
 *  Last modified:
 *     $Date: 2005-07-29 12:40:03 +0200 (Fri, 29 Jul 2005) $ by $Author: schulte $
 *     $Revision: 2076 $
 *
 *  This file is part of Gecode, the generic constraint
 *  development environment:
 *     http://www.gecode.org
 *
 *  See the file "LICENSE" for information on usage and
 *  redistribution of this file, and for a
 *     DISCLAIMER OF ALL WARRANTIES.
 *
 */

namespace Gecode { namespace Int { namespace Distinct {

  template <class T>
  forceinline
  CombPtrFlag<T>::CombPtrFlag(T* p1, T* p2)
    : cpf(reinterpret_cast<ptrdiff_t>(p1) ^ reinterpret_cast<ptrdiff_t>(p2)) {}

  template <class T>
  forceinline T*
  CombPtrFlag<T>::ptr(T* p) const {
    return reinterpret_cast<T*>((cpf&~1) ^ reinterpret_cast<ptrdiff_t>(p));
  }

  template <class T>
  forceinline int
  CombPtrFlag<T>::is_set(void) const {
    return static_cast<int>(cpf&1);
  }

  template <class T>
  forceinline void
  CombPtrFlag<T>::set(void) {
    cpf |= 1;
  }

  template <class T>
  forceinline void
  CombPtrFlag<T>::unset(void) {
    cpf &= ~1;
  }

  template <class T>
  forceinline void
  CombPtrFlag<T>::init(T* p1, T* p2) {
    cpf = reinterpret_cast<ptrdiff_t>(p1) ^ reinterpret_cast<ptrdiff_t>(p2);
  }

}}}

// STATISTICS: int-prop

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gecoder-with-gecode-0.7.1 ext/gecode-1.3.1/gecode/int/distinct/combptr.icc