MCPcopy Create free account
hub / github.com/JeanLucPons/VanitySearch / ModMulK1order

Method ModMulK1order

IntMod.cpp:1201–1258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1199
1200
1201void Int::ModMulK1order(Int *a) {
1202
1203 Int t;
1204 Int pr;
1205 Int p;
1206 uint64_t ML;
1207 uint64_t c;
1208
1209 imm_umul(a->bits64, bits64[0], pr.bits64);
1210 ML = pr.bits64[0] * MM64o;
1211 imm_umul(_O->bits64, ML, p.bits64);
1212 c = pr.AddC(&p);
1213 memcpy(t.bits64, pr.bits64 + 1, 32);
1214 t.bits64[4] = c;
1215
1216 for (int i = 1; i < 4; i++) {
1217
1218 imm_umul(a->bits64, bits64[i], pr.bits64);
1219 ML = (pr.bits64[0] + t.bits64[0]) * MM64o;
1220 imm_umul(_O->bits64, ML, p.bits64);
1221 c = pr.AddC(&p);
1222 t.AddAndShift(&t, &pr, c);
1223
1224 }
1225
1226 p.Sub(&t, _O);
1227 if (p.IsPositive())
1228 Set(&p);
1229 else
1230 Set(&t);
1231
1232
1233 // Normalize
1234
1235 imm_umul(_R2o.bits64, bits64[0], pr.bits64);
1236 ML = pr.bits64[0] * MM64o;
1237 imm_umul(_O->bits64, ML, p.bits64);
1238 c = pr.AddC(&p);
1239 memcpy(t.bits64, pr.bits64 + 1, 32);
1240 t.bits64[4] = c;
1241
1242 for (int i = 1; i < 4; i++) {
1243
1244 imm_umul(_R2o.bits64, bits64[i], pr.bits64);
1245 ML = (pr.bits64[0] + t.bits64[0]) * MM64o;
1246 imm_umul(_O->bits64, ML, p.bits64);
1247 c = pr.AddC(&p);
1248 t.AddAndShift(&t, &pr, c);
1249
1250 }
1251
1252 p.Sub(&t, _O);
1253 if (p.IsPositive())
1254 Set(&p);
1255 else
1256 Set(&t);
1257
1258}

Callers 3

CheckMethod · 0.80
checkPrivKeyMethod · 0.80
reconstructAddFunction · 0.80

Calls 5

imm_umulFunction · 0.85
AddCMethod · 0.80
AddAndShiftMethod · 0.80
SubMethod · 0.80
IsPositiveMethod · 0.80

Tested by

no test coverage detected