Skip to content

Commit 255113a

Browse files
committed
Fix windows build
1 parent 8005308 commit 255113a

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

algorithm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1867,7 +1867,7 @@ static cl_int queue_heavyhash_kernel(_clState *clState, dev_blk_ctx *blk, __mayb
18671867

18681868
memcpy(edata, clState->cldata, 80);
18691869

1870-
kt_sha3_256(seed, 32, edata+1, 32);
1870+
kt_sha3_256((uint8_t *)seed, 32, (uint8_t *)(edata + 1), 32);
18711871

18721872
for (int i = 0; i < 4; ++i) {
18731873
state.s[i] = le64dec(seed + 2*i);

algorithm/heavyhash-gate.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#include <math.h>
1212
#include <stdbool.h>
1313

14-
#define bswap_32( a ) __builtin_bswap32( a )
14+
#define bswap_32(x) ((((x) << 24) & 0xff000000u) | (((x) << 8) & 0x00ff0000u) \
15+
| (((x) >> 8) & 0x0000ff00u) | (((x) >> 24) & 0x000000ffu))
1516

1617
static inline void mm128_bswap32_80( void *d, void *s )
1718
{
@@ -169,7 +170,7 @@ int heavyhash_test(unsigned char *pdata, const unsigned char *ptarget, uint32_t
169170
uint16_t matrix[64][64];
170171
struct xoshiro_state state;
171172

172-
kt_sha3_256(seed, 32, data+1, 32);
173+
kt_sha3_256((uint8_t *)seed, 32, (uint8_t *)(data+1), 32);
173174

174175
for (int i = 0; i < 4; ++i) {
175176
state.s[i] = le64dec(seed + 2*i);
@@ -178,7 +179,7 @@ int heavyhash_test(unsigned char *pdata, const unsigned char *ptarget, uint32_t
178179
generate_matrix(matrix, &state);
179180

180181
data[19] = htobe32(nonce);
181-
heavyhash(matrix, data, 80, ohash);
182+
heavyhash(matrix, (uint8_t *)data, 80, (uint8_t *)ohash);
182183

183184
tmp_hash7 = be32toh(ohash[7]);
184185

@@ -202,7 +203,7 @@ void heavyhash_regenhash(struct work *work)
202203
uint16_t matrix[64][64];
203204
struct xoshiro_state state;
204205

205-
kt_sha3_256(seed, 32, data+1, 32);
206+
kt_sha3_256((uint8_t *)seed, 32, (uint8_t*) (data+1), 32);
206207

207208
for (int i = 0; i < 4; ++i) {
208209
state.s[i] = le64dec(seed + 2*i);
@@ -211,7 +212,7 @@ void heavyhash_regenhash(struct work *work)
211212
generate_matrix(matrix, &state);
212213

213214
data[19] = htobe32(*nonce);
214-
heavyhash(matrix, data, 80, ohash);
215+
heavyhash(matrix, (uint8_t *)data, 80, (uint8_t *)ohash);
215216
}
216217

217218
bool scanhash_heavyhash(struct thr_info *thr, const unsigned char *pmidstate,
@@ -232,7 +233,7 @@ bool scanhash_heavyhash(struct thr_info *thr, const unsigned char *pmidstate,
232233

233234
mm128_bswap32_80( edata, pdata );
234235

235-
kt_sha3_256(seed, 32, edata+1, 32);
236+
kt_sha3_256((uint8_t *) seed, 32, (uint8_t *) (edata+1), 32);
236237

237238
for (int i = 0; i < 4; ++i) {
238239
state.s[i] = le64dec(seed + 2*i);
@@ -243,7 +244,7 @@ bool scanhash_heavyhash(struct thr_info *thr, const unsigned char *pmidstate,
243244
do
244245
{
245246
edata[19] = n;
246-
heavyhash(matrix, edata, 80, hash);
247+
heavyhash(matrix, (uint8_t *)edata, 80, (uint8_t *)hash);
247248
/*if ( unlikely( valid_hash( hash, ptarget )) )
248249
{
249250
pdata[19] = bswap_32(n);

winbuild/sgminer.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@
409409
<ClInclude Include="..\algorithm\lyra2h.h" />
410410
<ClInclude Include="..\algorithm\mtp_algo.h" />
411411
<ClInclude Include="..\algorithm\allium.h" />
412-
<ClCompile Include="..\algorithm\keccak_tiny.h" />
413-
<ClCompile Include="..\algorithm\heavyhash-gate.h" />
412+
<ClInclude Include="..\algorithm\keccak_tiny.h" />
413+
<ClInclude Include="..\algorithm\heavyhash-gate.h" />
414414
<ClInclude Include="..\algorithm\neoscrypt.h" />
415415
<ClInclude Include="..\algorithm\pascal.h" />
416416
<ClInclude Include="..\algorithm\phi.h" />

0 commit comments

Comments
 (0)