MCPcopy Create free account
hub / github.com/albertobsd/keyhunt / ModSquareK1

Method ModSquareK1

secp256k1/IntMod.cpp:975–1091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

973}
974
975void Int::ModSquareK1(Int *a) {
976
977#ifndef _WIN64
978#if (__GNUC__ > 7) || (__GNUC__ == 7 && (__GNUC_MINOR__ > 2))
979 unsigned char c;
980#else
981 #warning "GCC lass than 7.3 detected, upgrade gcc to get best perfromance"
982 volatile unsigned char c;
983#endif
984#else
985 unsigned char c;
986#endif
987
988 uint64_t r512[8];
989 uint64_t u10, u11;
990 uint64_t t1;
991 uint64_t t2;
992 uint64_t t[5];
993
994
995 //k=0
996 r512[0] = _umul128(a->bits64[0], a->bits64[0], &t[1]);
997
998 //k=1
999 t[3] = _umul128(a->bits64[0], a->bits64[1], &t[4]);
1000 c = _addcarry_u64(0, t[3], t[3], &t[3]);
1001 c = _addcarry_u64(c, t[4], t[4], &t[4]);
1002 c = _addcarry_u64(c, 0, 0, &t1);
1003 c = _addcarry_u64(0, t[1], t[3], &t[3]);
1004 c = _addcarry_u64(c, t[4], 0, &t[4]);
1005 c = _addcarry_u64(c, t1, 0, &t1);
1006 r512[1] = t[3];
1007
1008 //k=2
1009 t[0] = _umul128(a->bits64[0], a->bits64[2], &t[1]);
1010 c = _addcarry_u64(0, t[0], t[0], &t[0]);
1011 c = _addcarry_u64(c, t[1], t[1], &t[1]);
1012 c = _addcarry_u64(c, 0, 0, &t2);
1013
1014 u10 = _umul128(a->bits64[1], a->bits64[1], &u11);
1015 c = _addcarry_u64(0, t[0] , u10, &t[0]);
1016 c = _addcarry_u64(c, t[1] , u11, &t[1]);
1017 c = _addcarry_u64(c, t2 , 0, &t2);
1018 c = _addcarry_u64(0, t[0], t[4], &t[0]);
1019 c = _addcarry_u64(c, t[1], t1, &t[1]);
1020 c = _addcarry_u64(c, t2, 0, &t2);
1021 r512[2] = t[0];
1022
1023 //k=3
1024 t[3] = _umul128(a->bits64[0], a->bits64[3], &t[4]);
1025 u10 = _umul128(a->bits64[1], a->bits64[2], &u11);
1026
1027 c = _addcarry_u64(0, t[3], u10, &t[3]);
1028 c = _addcarry_u64(c, t[4], u11, &t[4]);
1029 c = _addcarry_u64(c, 0, 0, &t1);
1030 t1 += t1;
1031 c = _addcarry_u64(0, t[3], t[3], &t[3]);
1032 c = _addcarry_u64(c, t[4], t[4], &t[4]);

Callers 6

AddDirectMethod · 0.45
Add2Method · 0.45
AddMethod · 0.45
DoubleMethod · 0.45
GetYMethod · 0.45
ECMethod · 0.45

Calls 2

_umul128Function · 0.85
imm_umulFunction · 0.85

Tested by

no test coverage detected