comparison DEPENDENCIES/generic/include/boost/multiprecision/detail/bitscan.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
6 // Comparison operators for cpp_int_backend: 6 // Comparison operators for cpp_int_backend:
7 // 7 //
8 #ifndef BOOST_MP_DETAIL_BITSCAN_HPP 8 #ifndef BOOST_MP_DETAIL_BITSCAN_HPP
9 #define BOOST_MP_DETAIL_BITSCAN_HPP 9 #define BOOST_MP_DETAIL_BITSCAN_HPP
10 10
11 #if defined(BOOST_MSVC) && (defined(_M_IX86) || defined(_M_X64))
12 #include <Intrin.h>
13 #endif
14
11 namespace boost{ namespace multiprecision{ namespace detail{ 15 namespace boost{ namespace multiprecision{ namespace detail{
12 16
13 template <class Unsigned> 17 template <class Unsigned>
14 inline unsigned find_lsb(Unsigned mask, const mpl::int_<0>&) 18 inline unsigned find_lsb(Unsigned mask, const mpl::int_<0>&)
15 { 19 {
33 } 37 }
34 return --index; 38 return --index;
35 } 39 }
36 40
37 #if defined(BOOST_MSVC) && (defined(_M_IX86) || defined(_M_X64)) 41 #if defined(BOOST_MSVC) && (defined(_M_IX86) || defined(_M_X64))
42
43 #pragma intrinsic(_BitScanForward,_BitScanReverse)
44
38 BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, const mpl::int_<1>&) 45 BOOST_FORCEINLINE unsigned find_lsb(unsigned long mask, const mpl::int_<1>&)
39 { 46 {
40 unsigned long result; 47 unsigned long result;
41 _BitScanForward(&result, mask); 48 _BitScanForward(&result, mask);
42 return result; 49 return result;
47 unsigned long result; 54 unsigned long result;
48 _BitScanReverse(&result, mask); 55 _BitScanReverse(&result, mask);
49 return result; 56 return result;
50 } 57 }
51 #ifdef _M_X64 58 #ifdef _M_X64
59
60 #pragma intrinsic(_BitScanForward64,_BitScanReverse64)
61
52 BOOST_FORCEINLINE unsigned find_lsb(unsigned __int64 mask, const mpl::int_<2>&) 62 BOOST_FORCEINLINE unsigned find_lsb(unsigned __int64 mask, const mpl::int_<2>&)
53 { 63 {
54 unsigned long result; 64 unsigned long result;
55 _BitScanForward64(&result, mask); 65 _BitScanForward64(&result, mask);
56 return result; 66 return result;