mirror of
https://github.com/boostorg/detail.git
synced 2025-06-29 05:51:07 +02:00
Compare commits
3 Commits
svn-branch
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
3b8219672d | |||
18dbae4700 | |||
06946f6607 |
@ -1,4 +1,4 @@
|
|||||||
/* Copyright 2003-2007 Joaqu<EFBFBD>n M L<EFBFBD>pez Mu<EFBFBD>oz.
|
/* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||||
* Distributed under the Boost Software License, Version 1.0.
|
* Distributed under the Boost Software License, Version 1.0.
|
||||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
* http://www.boost.org/LICENSE_1_0.txt)
|
* http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
@ -1,20 +1,16 @@
|
|||||||
// -------------------------------------
|
// -----------------------------------------------------------
|
||||||
// integer_log2.hpp
|
// integer_log2.hpp
|
||||||
//
|
//
|
||||||
// Gives the integer part of the logarithm, in base 2, of a
|
// Gives the integer part of the logarithm, in base 2, of a
|
||||||
// given number. Behavior is undefined if the argument is <= 0.
|
// given number. Behavior is undefined if the argument is <= 0.
|
||||||
//
|
//
|
||||||
//
|
// Copyright (c) 2003-2004, 2008 Gennaro Prota
|
||||||
// (C) Copyright Gennaro Prota 2003 - 2004.
|
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0.
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
// http://www.boost.org/LICENSE_1_0.txt)
|
// http://www.boost.org/LICENSE_1_0.txt)
|
||||||
//
|
//
|
||||||
// ------------------------------------------------------
|
// -----------------------------------------------------------
|
||||||
//
|
|
||||||
// $Id$
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef BOOST_INTEGER_LOG2_HPP_GP_20030301
|
#ifndef BOOST_INTEGER_LOG2_HPP_GP_20030301
|
||||||
#define BOOST_INTEGER_LOG2_HPP_GP_20030301
|
#define BOOST_INTEGER_LOG2_HPP_GP_20030301
|
||||||
@ -37,7 +33,7 @@ namespace boost {
|
|||||||
|
|
||||||
while (x != 1) {
|
while (x != 1) {
|
||||||
|
|
||||||
const T t = x >> n;
|
const T t = static_cast<T>(x >> n);
|
||||||
if (t) {
|
if (t) {
|
||||||
result += n;
|
result += n;
|
||||||
x = t;
|
x = t;
|
||||||
|
Reference in New Issue
Block a user