@@ -166,6 +166,12 @@ _mm_tzcnt_64(unsigned long long __X)
166166/* Define the default attributes for the functions in this file. */
167167#define __DEFAULT_FN_ATTRS __attribute__ ((__always_inline__, __nodebug__, __target__(" bmi" )))
168168
169+ #if defined(__cplusplus) && (__cplusplus >= 201103L)
170+ #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS constexpr
171+ #else
172+ #define __DEFAULT_FN_ATTRS_CONSTEXPR __DEFAULT_FN_ATTRS
173+ #endif
174+
169175// / Performs a bitwise AND of the second operand with the one's
170176// / complement of the first operand.
171177// /
@@ -223,9 +229,8 @@ __andn_u32(unsigned int __X, unsigned int __Y)
223229// / \returns An unsigned integer whose least significant bits contain the
224230// / extracted bits.
225231// / \see _bextr_u32
226- static __inline__ unsigned int __DEFAULT_FN_ATTRS
227- __bextr_u32 (unsigned int __X , unsigned int __Y )
228- {
232+ static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
233+ __bextr_u32 (unsigned int __X, unsigned int __Y) {
229234 return __builtin_ia32_bextr_u32 (__X, __Y);
230235}
231236
@@ -248,10 +253,9 @@ __bextr_u32(unsigned int __X, unsigned int __Y)
248253// / \returns An unsigned integer whose least significant bits contain the
249254// / extracted bits.
250255// / \see __bextr_u32
251- static __inline__ unsigned int __DEFAULT_FN_ATTRS
252- _bextr_u32 (unsigned int __X , unsigned int __Y , unsigned int __Z )
253- {
254- return __builtin_ia32_bextr_u32 (__X , ((__Y & 0xff ) | ((__Z & 0xff ) << 8 )));
256+ static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
257+ _bextr_u32 (unsigned int __X, unsigned int __Y, unsigned int __Z) {
258+ return __builtin_ia32_bextr_u32 (__X, ((__Y & 0xff ) | ((__Z & 0xff ) << 8 )));
255259}
256260
257261/* Intel-specified, single-leading-underscore version of BEXTR2 */
@@ -271,7 +275,7 @@ _bextr_u32(unsigned int __X, unsigned int __Y, unsigned int __Z)
271275// / \returns An unsigned integer whose least significant bits contain the
272276// / extracted bits.
273277// / \see __bextr_u32
274- static __inline__ unsigned int __DEFAULT_FN_ATTRS
278+ static __inline__ unsigned int __DEFAULT_FN_ATTRS_CONSTEXPR
275279_bextr2_u32 (unsigned int __X, unsigned int __Y) {
276280 return __builtin_ia32_bextr_u32 (__X, __Y);
277281}
@@ -444,9 +448,8 @@ __andn_u64 (unsigned long long __X, unsigned long long __Y)
444448// / \returns An unsigned 64-bit integer whose least significant bits contain the
445449// / extracted bits.
446450// / \see _bextr_u64
447- static __inline__ unsigned long long __DEFAULT_FN_ATTRS
448- __bextr_u64 (unsigned long long __X , unsigned long long __Y )
449- {
451+ static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
452+ __bextr_u64 (unsigned long long __X, unsigned long long __Y) {
450453 return __builtin_ia32_bextr_u64 (__X, __Y);
451454}
452455
@@ -469,10 +472,9 @@ __bextr_u64(unsigned long long __X, unsigned long long __Y)
469472// / \returns An unsigned 64-bit integer whose least significant bits contain the
470473// / extracted bits.
471474// / \see __bextr_u64
472- static __inline__ unsigned long long __DEFAULT_FN_ATTRS
473- _bextr_u64 (unsigned long long __X , unsigned int __Y , unsigned int __Z )
474- {
475- return __builtin_ia32_bextr_u64 (__X , ((__Y & 0xff ) | ((__Z & 0xff ) << 8 )));
475+ static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
476+ _bextr_u64 (unsigned long long __X, unsigned int __Y, unsigned int __Z) {
477+ return __builtin_ia32_bextr_u64 (__X, ((__Y & 0xff ) | ((__Z & 0xff ) << 8 )));
476478}
477479
478480/* Intel-specified, single-leading-underscore version of BEXTR2 */
@@ -492,7 +494,7 @@ _bextr_u64(unsigned long long __X, unsigned int __Y, unsigned int __Z)
492494// / \returns An unsigned 64-bit integer whose least significant bits contain the
493495// / extracted bits.
494496// / \see __bextr_u64
495- static __inline__ unsigned long long __DEFAULT_FN_ATTRS
497+ static __inline__ unsigned long long __DEFAULT_FN_ATTRS_CONSTEXPR
496498_bextr2_u64 (unsigned long long __X, unsigned long long __Y) {
497499 return __builtin_ia32_bextr_u64 (__X, __Y);
498500}
0 commit comments