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
// � Copyright Fernando Luis Cacciola Carballal 2000-2004 // Use, modification, and distribution is subject to 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 library home page at http://www.boost.org/libs/numeric/conversion // // Contact the author at: fernando_cacciola@hotmail.com // #ifndef BOOST_NUMERIC_CONVERSION_DETAIL_IS_SUBRANGED_FLC_12NOV2002_HPP #define BOOST_NUMERIC_CONVERSION_DETAIL_IS_SUBRANGED_FLC_12NOV2002_HPP #include "boost/config.hpp" #include "boost/limits.hpp" #include "boost/mpl/int.hpp" #include "boost/mpl/multiplies.hpp" #include "boost/mpl/less.hpp" #include "boost/mpl/equal_to.hpp" #include "boost/type_traits/is_same.hpp" #include "boost/numeric/conversion/detail/meta.hpp" #include "boost/numeric/conversion/detail/int_float_mixture.hpp" #include "boost/numeric/conversion/detail/sign_mixture.hpp" #include "boost/numeric/conversion/detail/udt_builtin_mixture.hpp" namespace boost { namespace numeric { namespace convdetail { //--------------------------------------------------------------- // Implementations of the compile time predicate "T is subranged" //--------------------------------------------------------------- // for integral to integral conversions template
struct subranged_Sig2Unsig { // Signed to unsigned conversions are 'subranged' because of possible loose // of negative values. typedef mpl::true_ type ; } ; // for unsigned integral to signed integral conversions template
struct subranged_Unsig2Sig { // IMPORTANT NOTE: // // This code assumes that signed/unsigned integral values are represented // such that: // // numeric_limits
::digits + 1 == numeric_limits
::digits // // The '+1' is required since numeric_limits<>::digits gives 1 bit less for signed integral types. // // This fact is used by the following logic: // // if ( (numeric_limits
::digits+1) < (2*numeric_limits
::digits) ) // then the conversion is subranged. // typedef mpl::int_< ::std::numeric_limits
::digits > S_digits ; typedef mpl::int_< ::std::numeric_limits
::digits > T_digits ; // T is signed, so take digits+1 typedef typename T_digits::next u_T_digits ; typedef mpl::int_<2> Two ; typedef typename mpl::multiplies
::type S_digits_times_2 ; typedef typename mpl::less
::type type ; } ; // for integral to integral conversions of the same sign. template
struct subranged_SameSign { // An integral conversion of the same sign is subranged if digits(T) < digits(S). typedef mpl::int_< ::std::numeric_limits
::digits > S_digits ; typedef mpl::int_< ::std::numeric_limits
::digits > T_digits ; typedef typename mpl::less
::type type ; } ; // for integral to float conversions template
struct subranged_Int2Float { typedef mpl::false_ type ; } ; // for float to integral conversions template
struct subranged_Float2Int { typedef mpl::true_ type ; } ; // for float to float conversions template
struct subranged_Float2Float { // If both T and S are floats, // compare exponent bits and if they match, mantisa bits. typedef mpl::int_< ::std::numeric_limits
::digits > S_mantisa ; typedef mpl::int_< ::std::numeric_limits
::digits > T_mantisa ; typedef mpl::int_< ::std::numeric_limits
::max_exponent > S_exponent ; typedef mpl::int_< ::std::numeric_limits
::max_exponent > T_exponent ; typedef typename mpl::less
::type T_smaller_exponent ; typedef typename mpl::equal_to
::type equal_exponents ; typedef mpl::less
T_smaller_mantisa ; typedef mpl::eval_if
not_bigger_exponent_case ; typedef typename mpl::eval_if
::type type ; } ; // for Udt to built-in conversions template
struct subranged_Udt2BuiltIn { typedef mpl::true_ type ; } ; // for built-in to Udt conversions template
struct subranged_BuiltIn2Udt { typedef mpl::false_ type ; } ; // for Udt to Udt conversions template
struct subranged_Udt2Udt { typedef mpl::false_ type ; } ; //------------------------------------------------------------------- // Selectors for the implementations of the subranged predicate //------------------------------------------------------------------- template
struct get_subranged_Int2Int { typedef subranged_SameSign
Sig2Sig ; typedef subranged_Sig2Unsig
Sig2Unsig ; typedef subranged_Unsig2Sig
Unsig2Sig ; typedef Sig2Sig Unsig2Unsig ; typedef typename get_sign_mixture
::type sign_mixture ; typedef typename for_sign_mixture
::type type ; } ; template
struct get_subranged_BuiltIn2BuiltIn { typedef get_subranged_Int2Int
Int2IntQ ; typedef subranged_Int2Float
Int2Float ; typedef subranged_Float2Int
Float2Int ; typedef subranged_Float2Float
Float2Float ; typedef mpl::identity
Int2FloatQ ; typedef mpl::identity
Float2IntQ ; typedef mpl::identity
Float2FloatQ ; typedef typename get_int_float_mixture
::type int_float_mixture ; typedef for_int_float_mixture
for_ ; typedef typename for_::type selected ; typedef typename selected::type type ; } ; template
struct get_subranged { typedef get_subranged_BuiltIn2BuiltIn
BuiltIn2BuiltInQ ; typedef subranged_BuiltIn2Udt
BuiltIn2Udt ; typedef subranged_Udt2BuiltIn
Udt2BuiltIn ; typedef subranged_Udt2Udt
Udt2Udt ; typedef mpl::identity
BuiltIn2UdtQ ; typedef mpl::identity
Udt2BuiltInQ ; typedef mpl::identity
Udt2UdtQ ; typedef typename get_udt_builtin_mixture
::type udt_builtin_mixture ; typedef typename for_udt_builtin_mixture
::type selected ; typedef typename selected::type selected2 ; typedef typename selected2::type type ; } ; //------------------------------------------------------------------- // Top level implementation selector. //------------------------------------------------------------------- template
struct get_is_subranged { typedef get_subranged
non_trivial_case ; typedef mpl::identity
trivial_case ; typedef is_same
is_trivial ; typedef typename mpl::if_
::type selected ; typedef typename selected::type type ; } ; } } } // namespace boost::numeric::convdetail #endif
is_subranged.hpp
Page URL
File URL
Prev
5/9
Next
Download
( 7 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.