manuel5975p 6 роки тому
батько
коміт
2171be21cc
4 змінених файлів з 12 додано та 2 видалено
  1. 1 1
      crypt/BigInt64.hpp
  2. 11 1
      crypt/intrin.hpp
  3. BIN
      test.obj
  4. BIN
      uint128_t.obj

+ 1 - 1
crypt/BigInt64.hpp

@@ -622,7 +622,7 @@ struct BigInt{
 			uint64_t carry = 0;
 			for(auto it2 = o.rbegin();it2 != o.rend();it2++){
 				uint64_t hi;
-				uint64_t lo = _mulx_u64(*it1, *it2, (unsigned long long*)&hi);
+				uint64_t lo = mulx_u64(*it1, *it2, (unsigned long long*)&hi);
 				bool ac = _adc_u64(lo, carry, (unsigned long long*)(&(*(it++))));
 				carry = hi + ac;
 			}

+ 11 - 1
crypt/intrin.hpp

@@ -1,6 +1,9 @@
 #ifndef INTRIN_HPP
 #define INTRIN_HPP
 #include <cstdint>
+#ifdef __clang__
+#undef _MSC_VER
+#endif
 #ifdef _DEF_INT128
 #error _DEF_INT128 cannot be directly set
 #elif defined(__SIZEOF_INT128__)
@@ -14,6 +17,9 @@
 #endif
 #endif
 #endif
+#ifdef __clang__
+#define _DEF_INT128
+#endif
 #ifndef _DEF_INT128
 #include "uint128_t.h"
 using uint_128bit = uint128_t;
@@ -33,13 +39,14 @@ bool _adc_u64(unsigned long long a,unsigned long long b,unsigned long long* c){
 bool _sbc_u64(unsigned long long a,unsigned long long b,unsigned long long* c){
 	 return __builtin_usubll_overflow(a, b, c);
 }
-inline unsigned long long _mulx_u64(unsigned long long a, unsigned long long b, unsigned long long* hi){
+inline unsigned long long mulx_u64(unsigned long long a, unsigned long long b, unsigned long long* hi){
 	__uint128_t r = ((__uint128_t)a) * b;
 	*hi = (unsigned long long)(r >> 64);
 	return r;
 }
 #endif
 #ifdef _MSC_VER
+#error Hallo
 #include <intrin.h>
 inline int _leading_zeros(unsigned long long x){
 	int index = 0;
@@ -58,5 +65,8 @@ bool _sbc_u64(unsigned long long a,unsigned long long b,unsigned long long* c){
 	 *c = a - b;
 	 return b > a;
 }
+inline unsigned long long mulx_u64(unsigned long long a, unsigned long long b, unsigned long long* hi){
+	return _mulx_u64(a,b,hi);
+}
 #endif
 #endif //INTRIN_HPP