Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63194 - sandbox/SOC/2010/bits_and_ints/boost/integer
From: muriloufg_at_[hidden]
Date: 2010-06-21 14:21:54


Author: murilov
Date: 2010-06-21 14:21:53 EDT (Mon, 21 Jun 2010)
New Revision: 63194
URL: http://svn.boost.org/trac/boost/changeset/63194

Log:
Added clear_least_bit_set() function
Added:
   sandbox/SOC/2010/bits_and_ints/boost/integer/clear_least_bit_set.hpp (contents, props changed)

Added: sandbox/SOC/2010/bits_and_ints/boost/integer/clear_least_bit_set.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bits_and_ints/boost/integer/clear_least_bit_set.hpp 2010-06-21 14:21:53 EDT (Mon, 21 Jun 2010)
@@ -0,0 +1,23 @@
+// Boost integer/clear_least_bit_set.hpp header file ------------------------------//
+
+// (C) Copyright Murilo Adriano Vasconcelos 2010.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#ifndef BOOST_CLEAR_LEAST_BIT_SET
+#define BOOST_CLEAR_LEAST_BIT_SET
+
+namespace boost {
+
+template <typename T>
+T clear_least_bit_set(T value)
+{
+ return (value & (value - 1));
+} //clear_least_bit_set
+
+} //boost
+
+#endif
\ No newline at end of file


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk