11
11
#include <math.h>
12
12
#include <stdbool.h>
13
13
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))
15
16
16
17
static inline void mm128_bswap32_80 ( void * d , void * s )
17
18
{
@@ -169,7 +170,7 @@ int heavyhash_test(unsigned char *pdata, const unsigned char *ptarget, uint32_t
169
170
uint16_t matrix [64 ][64 ];
170
171
struct xoshiro_state state ;
171
172
172
- kt_sha3_256 (seed , 32 , data + 1 , 32 );
173
+ kt_sha3_256 (( uint8_t * ) seed , 32 , ( uint8_t * )( data + 1 ) , 32 );
173
174
174
175
for (int i = 0 ; i < 4 ; ++ i ) {
175
176
state .s [i ] = le64dec (seed + 2 * i );
@@ -178,7 +179,7 @@ int heavyhash_test(unsigned char *pdata, const unsigned char *ptarget, uint32_t
178
179
generate_matrix (matrix , & state );
179
180
180
181
data [19 ] = htobe32 (nonce );
181
- heavyhash (matrix , data , 80 , ohash );
182
+ heavyhash (matrix , ( uint8_t * ) data , 80 , ( uint8_t * ) ohash );
182
183
183
184
tmp_hash7 = be32toh (ohash [7 ]);
184
185
@@ -202,7 +203,7 @@ void heavyhash_regenhash(struct work *work)
202
203
uint16_t matrix [64 ][64 ];
203
204
struct xoshiro_state state ;
204
205
205
- kt_sha3_256 (seed , 32 , data + 1 , 32 );
206
+ kt_sha3_256 (( uint8_t * ) seed , 32 , ( uint8_t * ) ( data + 1 ) , 32 );
206
207
207
208
for (int i = 0 ; i < 4 ; ++ i ) {
208
209
state .s [i ] = le64dec (seed + 2 * i );
@@ -211,7 +212,7 @@ void heavyhash_regenhash(struct work *work)
211
212
generate_matrix (matrix , & state );
212
213
213
214
data [19 ] = htobe32 (* nonce );
214
- heavyhash (matrix , data , 80 , ohash );
215
+ heavyhash (matrix , ( uint8_t * ) data , 80 , ( uint8_t * ) ohash );
215
216
}
216
217
217
218
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,
232
233
233
234
mm128_bswap32_80 ( edata , pdata );
234
235
235
- kt_sha3_256 (seed , 32 , edata + 1 , 32 );
236
+ kt_sha3_256 (( uint8_t * ) seed , 32 , ( uint8_t * ) ( edata + 1 ) , 32 );
236
237
237
238
for (int i = 0 ; i < 4 ; ++ i ) {
238
239
state .s [i ] = le64dec (seed + 2 * i );
@@ -243,7 +244,7 @@ bool scanhash_heavyhash(struct thr_info *thr, const unsigned char *pmidstate,
243
244
do
244
245
{
245
246
edata [19 ] = n ;
246
- heavyhash (matrix , edata , 80 , hash );
247
+ heavyhash (matrix , ( uint8_t * ) edata , 80 , ( uint8_t * ) hash );
247
248
/*if ( unlikely( valid_hash( hash, ptarget )) )
248
249
{
249
250
pdata[19] = bswap_32(n);
0 commit comments