Skip to content

Commit

Permalink
insure compilation on both linux and msvc
Browse files Browse the repository at this point in the history
  • Loading branch information
djm34 committed Feb 9, 2017
1 parent 3203243 commit c4fea3f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
4 changes: 4 additions & 0 deletions algorithm/ethash.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ uint32_t EthCalcEpochNumber(uint8_t *SeedHash)
uint8_t TestSeedHash[32] = { 0 };

for(int Epoch = 0; Epoch < 2048; ++Epoch) {
#ifdef _MSC_VER
SHA3_256((ethash_h256*)TestSeedHash, TestSeedHash, 32);
#else
SHA3_256(TestSeedHash, TestSeedHash, 32);
#endif
if(!memcmp(TestSeedHash, SeedHash, 32)) return(Epoch + 1);
}

Expand Down
11 changes: 6 additions & 5 deletions algorithm/yescryptcommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,15 @@ yescrypt_bsty(const uint8_t * passwd, size_t passwdlen,
const uint8_t * salt, size_t saltlen, uint64_t N, uint32_t r, uint32_t p,
uint8_t * buf, size_t buflen)
{
#ifdef _MSC_VER
static __declspec(thread) int initialized = 0;
static __declspec(thread) yescrypt_shared_t shared;
static __declspec(thread) yescrypt_local_t local;

// static __declspec(thread) int initialized = 0;
// static __declspec(thread) yescrypt_shared_t shared;
// static __declspec(thread) yescrypt_local_t local;

#else
static __declspec(thread) int initialized = 0;
static __declspec(thread) yescrypt_shared_t shared;
static __declspec(thread) yescrypt_local_t local;
#endif
int retval;
if (!initialized) {
/* "shared" could in fact be shared, but it's simpler to keep it private
Expand Down
7 changes: 5 additions & 2 deletions sysfs-gpu-controls.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#include <stdint.h>
#include <stdbool.h>
//#include <dirent.h>

#ifdef _MSC_VER
// well...
#else
#include <dirent.h>
#endif
#include "miner.h"

bool has_sysfs_hwcontrols = false;
Expand Down
5 changes: 4 additions & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2016,8 +2016,11 @@ bool parse_diff_ethash(char* Target, const char* TgtStr)
ret = hex2bin((unsigned char*)Target, TgtStr + 2, 32) || hex2bin((unsigned char*)Target, TgtStr, 32);
return ret;
}

#ifdef _MSC_VER
const double eth2pow256 = 115792089237316195423570985008687907853269984665640564039457584007913129639936.0;
#else
static const double eth2pow256 = 115792089237316195423570985008687907853269984665640564039457584007913129639936.0;
#endif
double le256todouble(const void *target);
static bool parse_notify_ethash(struct pool *pool, json_t *val)
{
Expand Down

0 comments on commit c4fea3f

Please sign in to comment.