DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
// -------------- Boost static_log2.hpp header file ----------------------- // // // Copyright (C) 2001 Daryle Walker. // Copyright (C) 2003 Vesa Karvonen. // Copyright (C) 2003 Gennaro Prota. // // 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/libs/integer for documentation. // ------------------------------------------------------------------------- // #ifndef BOOST_INTEGER_STATIC_LOG2_HPP #define BOOST_INTEGER_STATIC_LOG2_HPP #include "boost/config.hpp" // for BOOST_STATIC_CONSTANT namespace boost { namespace detail { namespace static_log2_impl { // choose_initial_n<> // // Recursively doubles its integer argument, until it // becomes >= of the "width" (C99, 6.2.6.2p4) of // static_log2_argument_type. // // Used to get the maximum power of two less then the width. // // Example: if on your platform argument_type has 48 value // bits it yields n=32. // // It's easy to prove that, starting from such a value // of n, the core algorithm works correctly for any width // of static_log2_argument_type and that recursion always // terminates with x = 1 and n = 0 (see the algorithm's // invariant). typedef unsigned long argument_type; typedef int result_type; template
struct choose_initial_n { enum { c = (argument_type(1) << n << n) != 0 }; BOOST_STATIC_CONSTANT( result_type, value = !c*n + choose_initial_n<2*c*n>::value ); }; template <> struct choose_initial_n<0> { BOOST_STATIC_CONSTANT(result_type, value = 0); }; // start computing from n_zero - must be a power of two const result_type n_zero = 16; const result_type initial_n = choose_initial_n
::value; // static_log2_impl<> // // * Invariant: // 2n // 1 <= x && x < 2 at the start of each recursion // (see also choose_initial_n<>) // // * Type requirements: // // argument_type maybe any unsigned type with at least n_zero + 1 // value bits. (Note: If larger types will be standardized -e.g. // unsigned long long- then the argument_type typedef can be // changed without affecting the rest of the code.) // template
struct static_log2_impl { enum { c = (x >> n) > 0 }; // x >= 2**n ? BOOST_STATIC_CONSTANT( result_type, value = c*n + (static_log2_impl< (x>>c*n), n/2 >::value) ); }; template <> struct static_log2_impl<1, 0> { BOOST_STATIC_CONSTANT(result_type, value = 0); }; } } // detail // -------------------------------------- // static_log2
// ---------------------------------------- typedef detail::static_log2_impl::argument_type static_log2_argument_type; typedef detail::static_log2_impl::result_type static_log2_result_type; template
struct static_log2 { BOOST_STATIC_CONSTANT( static_log2_result_type, value = detail::static_log2_impl::static_log2_impl
::value ); }; template <> struct static_log2<0> { }; } #endif // include guard
static_log2.hpp
Page URL
File URL
Prev
2/3
Next
Download
( 3 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.