Skip to content

Commit 6fa4ce9

Browse files
committed
Cosmit: strip trailing whitespace
It was done in a semi-automated way. Hopefully, no more of them would ever sneak back in again.
1 parent 48de0de commit 6fa4ce9

21 files changed

+128
-128
lines changed

Base58.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ bool DecodeBase58(const char* psz, std::vector<uint8_t> &vch) {
4848

4949
int length = (int)strlen(psz);
5050

51-
// Process the characters
51+
// Process the characters
5252
int digitslen = 1;
5353
digits[0] = 0;
5454
for (int i = 0; i < length; i++) {
@@ -80,7 +80,7 @@ bool DecodeBase58(const char* psz, std::vector<uint8_t> &vch) {
8080
for (int i = 0; i < zeroes; i++)
8181
vch.push_back(0);
8282

83-
// reverse
83+
// reverse
8484
for (int i = 0; i < digitslen; i++)
8585
vch.push_back(digits[digitslen - 1 - i]);
8686

@@ -92,7 +92,7 @@ std::string EncodeBase58(const unsigned char* pbegin, const unsigned char* pend)
9292

9393
std::string ret;
9494
unsigned char digits[256];
95-
95+
9696
// Skip leading zeroes
9797
while (pbegin != pend && *pbegin == 0) {
9898
ret.push_back('1');

GPU/GPUBase58.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ __device__ __noinline__ void _GetAddress(int type,uint32_t *hash,char *b58Add) {
5555
memcpy(A + 1, (char *)hash, 20);
5656

5757
// Compute checksum
58-
58+
5959
addBytes[0] = __byte_perm(hash[0], (uint32_t)A[0], 0x4012);
6060
addBytes[1] = __byte_perm(hash[0], hash[1], 0x3456);
6161
addBytes[2] = __byte_perm(hash[1], hash[2], 0x3456);

GPU/GPUCompute.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
// For the kernel, we use a 16 bits prefix lookup table which correspond to ~3 Base58 characters
2121
// A second level lookup table contains 32 bits prefix (if used)
2222
// (The CPU computes the full address and check the full prefix)
23-
//
23+
//
2424
// We use affine coordinates for elliptic curve point (ie Z=1)
2525

26-
__device__ __noinline__ void CheckPoint(uint32_t *_h, int32_t incr, int32_t endo, int32_t mode,prefix_t *prefix,
26+
__device__ __noinline__ void CheckPoint(uint32_t *_h, int32_t incr, int32_t endo, int32_t mode,prefix_t *prefix,
2727
uint32_t *lookup32, uint32_t maxFound, uint32_t *out,int type) {
2828

2929
uint32_t off;
@@ -37,7 +37,7 @@ __device__ __noinline__ void CheckPoint(uint32_t *_h, int32_t incr, int32_t endo
3737
uint32_t lmi;
3838
uint32_t tid = (blockIdx.x*blockDim.x) + threadIdx.x;
3939
char add[48];
40-
40+
4141
if (prefix == NULL) {
4242

4343
// No lookup compute address and return
@@ -47,9 +47,9 @@ __device__ __noinline__ void CheckPoint(uint32_t *_h, int32_t incr, int32_t endo
4747
// found
4848
goto addItem;
4949
}
50-
50+
5151
} else {
52-
52+
5353
// Lookup table
5454
pr0 = *(prefix_t *)(_h);
5555
hit = prefix[pr0];
@@ -100,7 +100,7 @@ __device__ __noinline__ void CheckPoint(uint32_t *_h, int32_t incr, int32_t endo
100100
#define CHECK_POINT(_h,incr,endo,mode) CheckPoint(_h,incr,endo,mode,prefix,lookup32,maxFound,out,P2PKH)
101101
#define CHECK_POINT_P2SH(_h,incr,endo,mode) CheckPoint(_h,incr,endo,mode,prefix,lookup32,maxFound,out,P2SH)
102102

103-
__device__ __noinline__ void CheckHashComp(prefix_t *prefix, uint64_t *px, uint8_t isOdd, int32_t incr,
103+
__device__ __noinline__ void CheckHashComp(prefix_t *prefix, uint64_t *px, uint8_t isOdd, int32_t incr,
104104
uint32_t *lookup32, uint32_t maxFound, uint32_t *out) {
105105

106106
uint32_t h[5];
@@ -153,7 +153,7 @@ __device__ __noinline__ void CheckHashP2SHComp(prefix_t *prefix, uint64_t *px, u
153153

154154
// -----------------------------------------------------------------------------------------
155155

156-
__device__ __noinline__ void CheckHashUncomp(prefix_t *prefix, uint64_t *px, uint64_t *py, int32_t incr,
156+
__device__ __noinline__ void CheckHashUncomp(prefix_t *prefix, uint64_t *px, uint64_t *py, int32_t incr,
157157
uint32_t *lookup32, uint32_t maxFound, uint32_t *out) {
158158

159159
uint32_t h[5];
@@ -211,7 +211,7 @@ __device__ __noinline__ void CheckHashP2SHUncomp(prefix_t *prefix, uint64_t *px,
211211

212212
// -----------------------------------------------------------------------------------------
213213

214-
__device__ __noinline__ void CheckHash(uint32_t mode, prefix_t *prefix, uint64_t *px, uint64_t *py, int32_t incr,
214+
__device__ __noinline__ void CheckHash(uint32_t mode, prefix_t *prefix, uint64_t *px, uint64_t *py, int32_t incr,
215215
uint32_t *lookup32, uint32_t maxFound, uint32_t *out) {
216216

217217
switch (mode) {
@@ -251,7 +251,7 @@ __device__ __noinline__ void CheckP2SHHash(uint32_t mode, prefix_t *prefix, uint
251251

252252
// -----------------------------------------------------------------------------------------
253253

254-
__device__ void ComputeKeys(uint32_t mode, uint64_t *startx, uint64_t *starty,
254+
__device__ void ComputeKeys(uint32_t mode, uint64_t *startx, uint64_t *starty,
255255
prefix_t *sPrefix, uint32_t *lookup32, uint32_t maxFound, uint32_t *out) {
256256

257257
uint64_t dx[GRP_SIZE/2+1][4];
@@ -312,7 +312,7 @@ __device__ void ComputeKeys(uint32_t mode, uint64_t *startx, uint64_t *starty,
312312

313313
ModSub256(py, Gx[i], px);
314314
_ModMult(py, _s); // py = - s*(ret.x-p2.x)
315-
ModSub256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
315+
ModSub256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
316316

317317
CHECK_PREFIX(GRP_SIZE / 2 + (i + 1));
318318

@@ -328,7 +328,7 @@ __device__ void ComputeKeys(uint32_t mode, uint64_t *startx, uint64_t *starty,
328328

329329
ModSub256(py, Gx[i], px);
330330
_ModMult(py, _s); // py = - s*(ret.x-p2.x)
331-
ModAdd256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
331+
ModAdd256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
332332

333333
CHECK_PREFIX(GRP_SIZE / 2 - (i + 1));
334334

@@ -348,7 +348,7 @@ __device__ void ComputeKeys(uint32_t mode, uint64_t *startx, uint64_t *starty,
348348

349349
ModSub256(py, Gx[i], px);
350350
_ModMult(py, _s); // py = - s*(ret.x-p2.x)
351-
ModAdd256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
351+
ModAdd256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
352352

353353
CHECK_PREFIX(0);
354354

@@ -367,7 +367,7 @@ __device__ void ComputeKeys(uint32_t mode, uint64_t *startx, uint64_t *starty,
367367

368368
ModSub256(py, _2Gnx, px);
369369
_ModMult(py, _s); // py = - s*(ret.x-p2.x)
370-
ModSub256(py, _2Gny); // py = - p2.y - s*(ret.x-p2.x);
370+
ModSub256(py, _2Gny); // py = - p2.y - s*(ret.x-p2.x);
371371

372372
}
373373

@@ -443,7 +443,7 @@ __device__ void ComputeKeysP2SH(uint32_t mode, uint64_t *startx, uint64_t *start
443443

444444
ModSub256(py, Gx[i], px);
445445
_ModMult(py, _s); // py = - s*(ret.x-p2.x)
446-
ModSub256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
446+
ModSub256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
447447

448448
CHECK_PREFIX_P2SH(GRP_SIZE / 2 + (i + 1));
449449

@@ -459,7 +459,7 @@ __device__ void ComputeKeysP2SH(uint32_t mode, uint64_t *startx, uint64_t *start
459459

460460
ModSub256(py, Gx[i], px);
461461
_ModMult(py, _s); // py = - s*(ret.x-p2.x)
462-
ModAdd256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
462+
ModAdd256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
463463

464464
CHECK_PREFIX_P2SH(GRP_SIZE / 2 - (i + 1));
465465

@@ -479,7 +479,7 @@ __device__ void ComputeKeysP2SH(uint32_t mode, uint64_t *startx, uint64_t *start
479479

480480
ModSub256(py, Gx[i], px);
481481
_ModMult(py, _s); // py = - s*(ret.x-p2.x)
482-
ModAdd256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
482+
ModAdd256(py, Gy[i]); // py = - p2.y - s*(ret.x-p2.x);
483483

484484
CHECK_PREFIX_P2SH(0);
485485

@@ -498,7 +498,7 @@ __device__ void ComputeKeysP2SH(uint32_t mode, uint64_t *startx, uint64_t *start
498498

499499
ModSub256(py, _2Gnx, px);
500500
_ModMult(py, _s); // py = - s*(ret.x-p2.x)
501-
ModSub256(py, _2Gny); // py = - p2.y - s*(ret.x-p2.x);
501+
ModSub256(py, _2Gny); // py = - p2.y - s*(ret.x-p2.x);
502502

503503
}
504504

@@ -629,7 +629,7 @@ __device__ void ComputeKeysComp(uint64_t *startx, uint64_t *starty, prefix_t *sP
629629

630630
ModSub256(py, _2Gnx, px);
631631
_ModMult(py, _s); // py = - s*(ret.x-p2.x)
632-
ModSub256(py, _2Gny); // py = - p2.y - s*(ret.x-p2.x);
632+
ModSub256(py, _2Gny); // py = - p2.y - s*(ret.x-p2.x);
633633

634634
}
635635

GPU/GPUEngine.cu

+7-7
Original file line numberDiff line numberDiff line change
@@ -579,10 +579,10 @@ bool GPUEngine::Launch(std::vector<ITEM> &prefixFound,bool spinWait) {
579579
}
580580
nbFound = maxFound;
581581
}
582-
582+
583583
// When can perform a standard copy, the kernel is eneded
584584
cudaMemcpy( outputPrefixPinned , outputPrefix , nbFound*ITEM_SIZE + 4 , cudaMemcpyDeviceToHost);
585-
585+
586586
for (uint32_t i = 0; i < nbFound; i++) {
587587
uint32_t *itemPtr = outputPrefixPinned + (i*ITEM_SIZE32 + 1);
588588
ITEM it;
@@ -701,7 +701,7 @@ bool GPUEngine::Check(Secp256K1 *secp) {
701701

702702
Point *p = new Point[nbThread];
703703
Point *p2 = new Point[nbThread];
704-
Int k;
704+
Int k;
705705

706706
// Check kernel
707707
int nbFoundCPU[6];
@@ -738,12 +738,12 @@ bool GPUEngine::Check(Secp256K1 *secp) {
738738
Launch(found,true);
739739
double t1 = Timer::get_tick();
740740
Timer::printResult((char *)"Key", 6*STEP_SIZE*nbThread, t0, t1);
741-
741+
742742
//for (int i = 0; i < found.size(); i++) {
743743
// printf("[%d]: thId=%d incr=%d\n", i, found[i].thId,found[i].incr);
744744
// printf("[%d]: %s\n", i,toHex(found[i].hash,20).c_str());
745745
//}
746-
746+
747747
printf("ComputeKeys() found %d items , CPU check...\n",(int)found.size());
748748

749749
Int beta,beta2;
@@ -753,7 +753,7 @@ bool GPUEngine::Check(Secp256K1 *secp) {
753753
// Check with CPU
754754
for (j = 0; (j<nbThread); j++) {
755755
for (i = 0; i < STEP_SIZE; i++) {
756-
756+
757757
Point pt,p1,p2;
758758
pt = p[j];
759759
p1 = p[j];
@@ -818,7 +818,7 @@ bool GPUEngine::Check(Secp256K1 *secp) {
818818

819819
int nbF = nbFoundCPU[0] + nbFoundCPU[1] + nbFoundCPU[2] +
820820
nbFoundCPU[3] + nbFoundCPU[4] + nbFoundCPU[5];
821-
printf("CPU found %d items\n",nbF);
821+
printf("CPU found %d items\n",nbF);
822822

823823
printf("GPU: point correct [%d/%d]\n", nbOK[0] , nbFoundCPU[0]);
824824
printf("GPU: endo #1 correct [%d/%d]\n", nbOK[1] , nbFoundCPU[1]);

GPU/GPUEngine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class GPUEngine {
5656

5757
public:
5858

59-
GPUEngine(int nbThreadGroup,int nbThreadPerGroup,int gpuId,uint32_t maxFound,bool rekey);
59+
GPUEngine(int nbThreadGroup,int nbThreadPerGroup,int gpuId,uint32_t maxFound,bool rekey);
6060
~GPUEngine();
6161
void SetPrefix(std::vector<prefix_t> prefixes);
6262
void SetPrefix(std::vector<LPREFIX> prefixes,uint32_t totalPrefix);

GPU/GPUHash.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ __device__ __constant__ uint32_t I[] = {
5656
__device__ __forceinline__ uint32_t S0(uint32_t x) {
5757

5858
uint32_t y;
59-
asm("{\n\t"
59+
asm("{\n\t"
6060
" .reg .u64 r1,r2,r3;\n\t"
6161
" cvt.u64.u32 r1, %1;\n\t"
6262
" mov.u64 r2, r1;\n\t"
@@ -217,7 +217,7 @@ __device__ void SHA256Initialize(uint32_t s[8]) {
217217

218218
// Perform SHA-256 transformations, process 64-byte chunks
219219
__device__ void SHA256Transform(uint32_t s[8],uint32_t* w) {
220-
220+
221221
uint32_t t1;
222222
uint32_t t2;
223223

GPU/GPUMath.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ __device__ __noinline__ void _ModInv(uint64_t *R) {
356356

357357
// u' = (uu*u + uv*v) >> bitCount
358358
// v' = (vu*u + vv*v) >> bitCount
359-
// Do not maintain a matrix for r and s, the number of
359+
// Do not maintain a matrix for r and s, the number of
360360
// 'added P' can be easily calculated
361361
uu = 1; uv = 0;
362362
vu = 0; vv = 1;
@@ -446,7 +446,7 @@ __device__ __noinline__ void _ModInv(uint64_t *R) {
446446
return;
447447
}
448448

449-
// In very rare case |s|>2P
449+
// In very rare case |s|>2P
450450
while(_IsNegative(s))
451451
AddP(s);
452452
while(!_IsNegative(s))
@@ -493,14 +493,14 @@ __device__ void _ModMult(uint64_t *r, uint64_t *a, uint64_t *b) {
493493
UADDC1(r512[6], t[3]);
494494
UADD1(r512[7], t[4]);
495495

496-
// Reduce from 512 to 320
496+
// Reduce from 512 to 320
497497
UMult(t, (r512 + 4), 0x1000003D1ULL);
498498
UADDO1(r512[0], t[0]);
499499
UADDC1(r512[1], t[1]);
500500
UADDC1(r512[2], t[2]);
501501
UADDC1(r512[3], t[3]);
502502

503-
// Reduce from 320 to 256
503+
// Reduce from 320 to 256
504504
UADD1(t[4], 0ULL);
505505
UMULLO(al, t[4], 0x1000003D1ULL);
506506
UMULHI(ah, t[4], 0x1000003D1ULL);
@@ -542,7 +542,7 @@ __device__ void _ModMult(uint64_t *r, uint64_t *a) {
542542
UADDC1(r512[6], t[3]);
543543
UADD1(r512[7], t[4]);
544544

545-
// Reduce from 512 to 320
545+
// Reduce from 512 to 320
546546
UMult(t, (r512 + 4), 0x1000003D1ULL);
547547
UADDO1(r512[0], t[0]);
548548
UADDC1(r512[1], t[1]);
@@ -666,7 +666,7 @@ __device__ void _ModSqr(uint64_t *rp, const uint64_t *up) {
666666

667667
#if 1
668668

669-
// Reduce from 512 to 320
669+
// Reduce from 512 to 320
670670
UMULLO(r0, r512[4], 0x1000003D1ULL);
671671
UMULLO(r1, r512[5], 0x1000003D1ULL);
672672
MADDO(r1, r512[4], 0x1000003D1ULL, r1);

0 commit comments

Comments
 (0)