Permalink
Browse files

clean up SWAP definitions

  • Loading branch information...
1 parent 9dce7cf commit d8fc392765f928835420334a5a3ba56ffc83f2fd @KlausT committed Sep 4, 2016
Showing with 4 additions and 16 deletions.
  1. +1 −3 fuguecoin.cpp
  2. +1 −3 groestlcoin.cpp
  3. +2 −6 heavy/cuda_blake512.cu
  4. +0 −4 myriadgroestl.cpp
View
@@ -22,9 +22,7 @@ extern "C" void my_fugue256_addbits_and_close(void *cc, unsigned ub, unsigned n,
// vorbereitete Kontexte nach den ersten 80 Bytes
// sph_fugue256_context ctx_fugue_const[MAX_GPUS];
-#define SWAP32(x) \
- ((((x) << 24) & 0xff000000u) | (((x) << 8) & 0x00ff0000u) | \
- (((x) >> 8) & 0x0000ff00u) | (((x) >> 24) & 0x000000ffu))
+#define SWAP32(x) swab32(x)
extern int scanhash_fugue256(int thr_id, uint32_t *pdata, uint32_t *ptarget,
uint32_t max_nonce, uint32_t *hashes_done)
View
@@ -27,9 +27,7 @@ do { \
} \
} while (0)
-#define SWAP32(x) \
- ((((x) << 24) & 0xff000000u) | (((x) << 8) & 0x00ff0000u) | \
- (((x) >> 8) & 0x0000ff00u) | (((x) >> 24) & 0x000000ffu))
+#define SWAP32(x) swab32(x)
// CPU-groestl
extern "C" void groestlhash(void *state, const void *input)
@@ -39,15 +39,11 @@ const uint8_t host_sigma[16][16] =
{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 }
};
-/* in cuda_helper */
-#define SWAP32(x) cuda_swab32(x)
-#define SWAP64(x) cuda_swab64(x)
-
__constant__ uint64_t c_SecondRound[15];
const uint64_t host_SecondRound[15] =
{
- 0,0,0,0,0,0,0,0,0,0,0,0,0,SWAP64(1),0
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0x0100000000000000,0
};
__constant__ uint64_t c_u512[16];
@@ -179,7 +175,7 @@ template <int BLOCKSIZE> __global__ void blake512_gpu_hash(uint32_t threads, uin
// zweite Runde
#pragma unroll 15
for (int i=0; i < 15; ++i) buf[i] = c_SecondRound[i];
- buf[15] = SWAP64(8*(BLOCKSIZE+32)); // Blocksize in Bits einsetzen
+ buf[15] = cuda_swab64(8 * (BLOCKSIZE + 32)); // Blocksize in Bits einsetzen
blake512_compress<BLOCKSIZE>( h, buf, 1, c_sigma, c_u512 );
// Hash rauslassen
View
@@ -18,10 +18,6 @@ void myriadgroestl_cpu_init(int thr_id, uint32_t threads);
void myriadgroestl_cpu_setBlock(int thr_id, void *data, void *pTargetIn);
void myriadgroestl_cpu_hash(int thr_id, uint32_t threads, uint32_t startNounce, uint32_t *nounce);
-#define SWAP32(x) \
- ((((x) << 24) & 0xff000000u) | (((x) << 8) & 0x00ff0000u) | \
- (((x) >> 8) & 0x0000ff00u) | (((x) >> 24) & 0x000000ffu))
-
extern "C" void myriadhash(void *state, const void *input)
{
uint32_t hashA[16], hashB[16];

0 comments on commit d8fc392

Please sign in to comment.