00001 // Software License for MTL 00002 // 00003 // Copyright (c) 2007 The Trustees of Indiana University. 00004 // 2008 Dresden University of Technology and the Trustees of Indiana University. 00005 // All rights reserved. 00006 // Authors: Peter Gottschling and Andrew Lumsdaine 00007 // 00008 // This file is part of the Matrix Template Library 00009 // 00010 // See also license.mtl.txt in the distribution. 00011 00012 #ifndef META_MATH_LEAST_SIGNIFICANT_ONE_BIT_INCLUDE 00013 #define META_MATH_LEAST_SIGNIFICANT_ONE_BIT_INCLUDE 00014 00015 namespace meta_math { 00016 00017 template <unsigned long X> 00018 struct least_significant_one_bit 00019 { 00020 static const unsigned long value= ((X ^ (X-1)) + 1) >> 1; 00021 }; 00022 00023 00024 } // namespace meta_math 00025 00026 #endif // META_MATH_LEAST_SIGNIFICANT_ONE_BIT_INCLUDE