Generated on Wed Nov 1 15:04:33 2006 for Gecode by doxygen 1.4.5

combptr.icc

Go to the documentation of this file.
00001 /*
00002  *  Main authors:
00003  *     Christian Schulte <schulte@gecode.org>
00004  *
00005  *  Copyright:
00006  *     Christian Schulte, 2003
00007  *
00008  *  Last modified:
00009  *     $Date: 2005-07-29 12:40:03 +0200 (Fri, 29 Jul 2005) $ by $Author: schulte $
00010  *     $Revision: 2076 $
00011  *
00012  *  This file is part of Gecode, the generic constraint
00013  *  development environment:
00014  *     http://www.gecode.org
00015  *
00016  *  See the file "LICENSE" for information on usage and
00017  *  redistribution of this file, and for a
00018  *     DISCLAIMER OF ALL WARRANTIES.
00019  *
00020  */
00021 
00022 namespace Gecode { namespace Int { namespace Distinct {
00023 
00024   template <class T>
00025   forceinline
00026   CombPtrFlag<T>::CombPtrFlag(T* p1, T* p2)
00027     : cpf(reinterpret_cast<ptrdiff_t>(p1) ^ reinterpret_cast<ptrdiff_t>(p2)) {}
00028 
00029   template <class T>
00030   forceinline T*
00031   CombPtrFlag<T>::ptr(T* p) const {
00032     return reinterpret_cast<T*>((cpf&~1) ^ reinterpret_cast<ptrdiff_t>(p));
00033   }
00034 
00035   template <class T>
00036   forceinline int
00037   CombPtrFlag<T>::is_set(void) const {
00038     return static_cast<int>(cpf&1);
00039   }
00040 
00041   template <class T>
00042   forceinline void
00043   CombPtrFlag<T>::set(void) {
00044     cpf |= 1;
00045   }
00046 
00047   template <class T>
00048   forceinline void
00049   CombPtrFlag<T>::unset(void) {
00050     cpf &= ~1;
00051   }
00052 
00053   template <class T>
00054   forceinline void
00055   CombPtrFlag<T>::init(T* p1, T* p2) {
00056     cpf = reinterpret_cast<ptrdiff_t>(p1) ^ reinterpret_cast<ptrdiff_t>(p2);
00057   }
00058 
00059 }}}
00060 
00061 // STATISTICS: int-prop
00062