Skip to content

Commit

Permalink
axiom: vstudio fix (memory problem)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed Jul 27, 2015
1 parent 7b17c5a commit 099a8df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
27 changes: 12 additions & 15 deletions algo/axiom.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

#include "sha3/sph_shabal.h"

static __thread uint32_t _ALIGN(128) M[65536][8];

void axiomhash(void *output, const void *input)
{
uint32_t _ALIGN(128) M[65536][8];
sph_shabal256_context ctx;
int R = 2, N = 65536;
const int R = 2, N = 65536;

sph_shabal256_init(&ctx);
sph_shabal256(&ctx, input, 80);
Expand All @@ -21,21 +22,17 @@ void axiomhash(void *output, const void *input)
sph_shabal256_close(&ctx, M[i]);
}

for(int r = 1; r < R; r ++)
for(int r = 1; r < R; r++)
{
for(int b = 0; b < N; b++)
{
int p = (b - 1 + N) % N;
int q = M[p][0] % 0xFFFF;
int j = (b + q) % N;
uint32_t _ALIGN(128) pj[2][8];

memcpy(&pj[0], &M[p], 32);
memcpy(&pj[1], &M[j], 32);
const int p = b > 0 ? b - 1 : 0xFFFF;
const int q = M[p][0] % 0xFFFF;
const int j = (b + q) % N;

//HashShabal((unsigned char*)&pj[0], 2 * sizeof(pj[0]), (unsigned char*)&M[b]);
//sph_shabal256_init(&ctx);
sph_shabal256(&ctx, (unsigned char*) (&pj[0]), 64);
sph_shabal256(&ctx, M[p], 32);
sph_shabal256(&ctx, M[j], 32);
sph_shabal256_close(&ctx, M[b]);
}
}
Expand All @@ -46,8 +43,8 @@ void axiomhash(void *output, const void *input)
int scanhash_axiom(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, uint64_t *hashes_done)
{
uint32_t _ALIGN(64) hash64[8];
uint32_t _ALIGN(64) endiandata[20];
uint32_t _ALIGN(128) hash64[8];
uint32_t _ALIGN(128) endiandata[20];

const uint32_t Htarg = ptarget[7];
const uint32_t first_nonce = pdata[19];
Expand All @@ -56,7 +53,7 @@ int scanhash_axiom(int thr_id, uint32_t *pdata, const uint32_t *ptarget,

for (int i=0; i < 19; i++) {
be32enc(&endiandata[i], pdata[i]);
};
}

do {
be32enc(&endiandata[19], n);
Expand Down
3 changes: 3 additions & 0 deletions cpuminer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@
<ClCompile Include="algo\bmw256.c">
<Filter>algo</Filter>
</ClCompile>
<ClCompile Include="algo\axiom.c">
<Filter>algo</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="sha3\sph_blake.h">
Expand Down

0 comments on commit 099a8df

Please sign in to comment.