Merge pull request #243 from ThomsonTan/FixIntrinsic
_umul128 intrinsic is x64 only and not available on Windows ARM64
This commit is contained in:
		
						commit
						9449ae9439
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -43,10 +43,10 @@
 | 
				
			||||||
// builtin type.  We need to make sure not to define operator wchar_t()
 | 
					// builtin type.  We need to make sure not to define operator wchar_t()
 | 
				
			||||||
// alongside operator unsigned short() in these instances.
 | 
					// alongside operator unsigned short() in these instances.
 | 
				
			||||||
#define ABSL_INTERNAL_WCHAR_T __wchar_t
 | 
					#define ABSL_INTERNAL_WCHAR_T __wchar_t
 | 
				
			||||||
#if defined(_WIN64)
 | 
					#if defined(_M_X64)
 | 
				
			||||||
#include <intrin.h>
 | 
					#include <intrin.h>
 | 
				
			||||||
#pragma intrinsic(_umul128)
 | 
					#pragma intrinsic(_umul128)
 | 
				
			||||||
#endif  // defined(_WIN64)
 | 
					#endif  // defined(_M_X64)
 | 
				
			||||||
#else   // defined(_MSC_VER)
 | 
					#else   // defined(_MSC_VER)
 | 
				
			||||||
#define ABSL_INTERNAL_WCHAR_T wchar_t
 | 
					#define ABSL_INTERNAL_WCHAR_T wchar_t
 | 
				
			||||||
#endif  // defined(_MSC_VER)
 | 
					#endif  // defined(_MSC_VER)
 | 
				
			||||||
| 
						 | 
					@ -675,7 +675,7 @@ inline uint128 operator*(uint128 lhs, uint128 rhs) {
 | 
				
			||||||
  // can be used for uint128 storage.
 | 
					  // can be used for uint128 storage.
 | 
				
			||||||
  return static_cast<unsigned __int128>(lhs) *
 | 
					  return static_cast<unsigned __int128>(lhs) *
 | 
				
			||||||
         static_cast<unsigned __int128>(rhs);
 | 
					         static_cast<unsigned __int128>(rhs);
 | 
				
			||||||
#elif defined(_MSC_VER) && defined(_WIN64)
 | 
					#elif defined(_MSC_VER) && defined(_M_X64)
 | 
				
			||||||
  uint64_t carry;
 | 
					  uint64_t carry;
 | 
				
			||||||
  uint64_t low = _umul128(Uint128Low64(lhs), Uint128Low64(rhs), &carry);
 | 
					  uint64_t low = _umul128(Uint128Low64(lhs), Uint128Low64(rhs), &carry);
 | 
				
			||||||
  return MakeUint128(Uint128Low64(lhs) * Uint128High64(rhs) +
 | 
					  return MakeUint128(Uint128Low64(lhs) * Uint128High64(rhs) +
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue